├── .gitignore ├── Arnold ├── __init__.py └── arnold_helper.py ├── CentiLeo ├── __init__.py └── centileo_helper.py ├── ChangeLog.md ├── Corona ├── __init__.py └── corona_helper.py ├── Octane ├── __init__.py └── octane_helper.py ├── Redshift ├── __init__.py └── redshift_helper.py ├── Vray ├── __init__.py └── vray_helper.py ├── __init__.py ├── constants ├── Arnold.json ├── CentiLeo.json ├── Redshift.json ├── Vray.json ├── __init__.py ├── arnold_id.py ├── centileo_id.py ├── common_id.py ├── corona_id.py ├── descriptions │ ├── __init__.py │ ├── color_correction.py │ ├── image.py │ └── output.py ├── octane_id.py ├── redshift_id.py └── vray_id.py ├── readme.md ├── tests ├── 01_material_basic.py ├── 02_aov_basic.py ├── 03_scene_basic.py └── __init__.py ├── utils ├── __init__.py ├── _description_helper.py ├── material_maker.py ├── node_helper.py └── texture_helper.py └── versions ├── NOTE.md ├── ReadME.md └── renderEngine ├── ReadME.md ├── __init__.py ├── arnold ├── Arnold.md ├── __init__.py ├── arnold_example.py ├── arnold_examples.py ├── arnold_helper.py └── arnold_id.py ├── node_helper.md ├── node_helper.py ├── octane ├── Octane.md ├── __init__.py ├── octane_examples.py ├── octane_helper.py └── octane_id.py └── redshift ├── Redshift.md ├── __init__.py ├── redshift_example.py ├── redshift_examples.py ├── redshift_helper.py └── redshift_id.py /.gitignore: -------------------------------------------------------------------------------- 1 | /__pycache__ 2 | /metadata.json -------------------------------------------------------------------------------- /Arnold/__init__.py: -------------------------------------------------------------------------------- 1 | #!c4dpy 2 | # -*- coding: utf-8 -*- 3 | 4 | """Provides classes that expose commonly used constants as immutable objects. 5 | """ 6 | from typing import Union, Optional 7 | import c4d 8 | import Renderer 9 | from Renderer.constants.arnold_id import * 10 | from Renderer.Arnold.arnold_helper import AOVHelper as AOV, MaterialHelper as Material, SceneHelper as Scene 11 | from Renderer.Arnold.arnold_helper import GetShaderLink, SetShaderLink, GetVColor, SetVColor 12 | 13 | def GetPreference() -> c4d.BaseList2D: 14 | prefs = c4d.plugins.FindPlugin(ID_PREFERENCES_NODE) 15 | if not isinstance(prefs, c4d.BaseList2D): 16 | raise RuntimeError("Could not access preferences node.") 17 | descIdSettings = c4d.DescID( 18 | c4d.DescLevel(1036062, 1, 465001632), # pref ID Arnold 19 | c4d.DescLevel(888, 133, 465001632) 20 | ) 21 | # Set 22 | return prefs[descIdSettings] 23 | 24 | def IsArnoldMaterial(material: c4d.BaseMaterial) -> bool: 25 | if material is None: 26 | return False 27 | return material.CheckType(ARNOLD_SHADER_NETWORK) or material.GetNodeMaterialReference().HasSpace(AR_NODESPACE) 28 | 29 | # 首选项设置为Node材质 30 | def IsNodeBased() -> bool: 31 | """ 32 | Check if Arnold use node material mode. 33 | """ 34 | return not GetPreference()[c4d.PARNOLD_MATERIAL_SYSTEM] 35 | 36 | # 获取渲染器版本 37 | def GetVersion(document: c4d.documents.BaseDocument = None) -> str : 38 | """ 39 | Get the version number of Arnold. 40 | 41 | Returns: 42 | str: The version number 43 | """ 44 | if not document: 45 | document = c4d.documents.GetActiveDocument() 46 | arnoldSceneHook = document.FindSceneHook(ARNOLD_SCENE_HOOK) 47 | if arnoldSceneHook is None: 48 | return "" 49 | 50 | msg = c4d.BaseContainer() 51 | msg.SetInt32(C4DTOA_MSG_TYPE, C4DTOA_MSG_GET_VERSION) 52 | arnoldSceneHook.Message(c4d.MSG_BASECONTAINER, msg) 53 | 54 | return msg.GetString(C4DTOA_MSG_RESP1) 55 | 56 | # 获取渲染器核心版本 57 | def GetCoreVersion(document: c4d.documents.BaseDocument = None) -> str : 58 | """ 59 | Get the core version of Arnold. 60 | 61 | Returns: 62 | str: The version number 63 | """ 64 | if not document: 65 | document = c4d.documents.GetActiveDocument() 66 | arnoldSceneHook = document.FindSceneHook(ARNOLD_SCENE_HOOK) 67 | if arnoldSceneHook is None: 68 | return "" 69 | 70 | msg = c4d.BaseContainer() 71 | msg.SetInt32(C4DTOA_MSG_TYPE, C4DTOA_MSG_GET_VERSION) 72 | arnoldSceneHook.Message(c4d.MSG_BASECONTAINER, msg) 73 | 74 | return msg.GetString(C4DTOA_MSG_RESP2) 75 | 76 | def OpenIPR(): 77 | c4d.CallCommand(1032195) # Arnold IPR Window 78 | 79 | # 打开材质编辑器 80 | def OpenNodeEditor(actmat: c4d.BaseMaterial = None) -> None: 81 | """ 82 | Open Node Editor for given material. 83 | """ 84 | if not actmat: 85 | doc = c4d.documents.GetActiveDocument() 86 | actmat = doc.GetActiveMaterial() 87 | else: 88 | doc = actmat.GetDocument() 89 | doc.AddUndo(c4d.UNDOTYPE_BITS,actmat) 90 | actmat.SetBit(c4d.BIT_ACTIVE) 91 | if not actmat: 92 | raise ValueError("Failed to retrieve a Material.") 93 | 94 | if Renderer.GetRenderEngine() == ARNOLD_RENDERER: 95 | if IsNodeBased(): 96 | if not c4d.IsCommandChecked(Renderer.CID_NODE_EDITOR): 97 | c4d.CallCommand(Renderer.CID_NODE_EDITOR) # Node Editor... 98 | c4d.CallCommand(465002360) # Material 99 | else: 100 | c4d.CallCommand(1033989) # Arnold Shader Graph Editor 101 | # Only scroll to the material if material manager is opened 102 | 103 | if c4d.IsCommandChecked(ID_MATERIAL_MANAGER): 104 | c4d.CallCommand(16297) # Scroll To Selection 105 | 106 | # 打开材质编辑器 107 | def AovManager(document: c4d.documents.BaseDocument = None, driverType: Union[str,c4d.BaseObject,None] = None) -> None: 108 | """ 109 | Open aov Manager. 110 | """ 111 | if not document: 112 | document = c4d.documents.GetActiveDocument() 113 | if isinstance(driverType,c4d.BaseObject): 114 | the_driver = driverType 115 | if isinstance(driverType, str): 116 | aov_helper = AOV(Renderer.GetVideoPost(document, Renderer.ID_ARNOLD)) 117 | the_driver = aov_helper.get_driver(driverType) 118 | 119 | if driverType is None: 120 | aov_helper = AOV(Renderer.GetVideoPost(document, Renderer.ID_ARNOLD)) 121 | drivers = Renderer.get_nodes(document,[ARNOLD_DRIVER]) 122 | if not drivers: 123 | the_driver: c4d.BaseObject = aov_helper.create_aov_driver(isDisplay=True) 124 | # 只有一个driver 125 | if len(drivers) == 1: 126 | the_driver = drivers[0] 127 | # 有多个driver 128 | elif len(drivers) > 1: 129 | the_driver = aov_helper.get_dispaly_driver() 130 | c4d.CallButton(the_driver, C4DAI_DRIVER_SETUP_AOVS) 131 | 132 | # 打开贴图管理器 133 | def TextureManager() -> None: 134 | """ 135 | Open Texture Manager. 136 | """ 137 | c4d.CallCommand(1034460) # Asset/Tx Manager 138 | 139 | # 打开灯光管理器 140 | def LightManager(): 141 | c4d.CallCommand(1039255) # light 142 | -------------------------------------------------------------------------------- /CentiLeo/__init__.py: -------------------------------------------------------------------------------- 1 | #!c4dpy 2 | # -*- coding: utf-8 -*- 3 | 4 | """Provides classes that expose commonly used constants as immutable objects. 5 | """ 6 | from typing import Union, Optional 7 | import c4d 8 | import Renderer 9 | from Renderer.constants.centileo_id import * 10 | from Renderer.CentiLeo.centileo_helper import AOVHelper as AOV, MaterialHelper as Material 11 | 12 | ID_PREFERENCES_NODE = 465001632 # Prefs ID 13 | ID_MATERIAL_MANAGER: int = 12159 # Material Manager 14 | 15 | def GetPreference() -> c4d.BaseList2D: 16 | prefs = c4d.plugins.FindPlugin(ID_PREFERENCES_NODE) 17 | if not isinstance(prefs, c4d.BaseList2D): 18 | raise RuntimeError("Could not access preferences node.") 19 | descIdSettings = c4d.DescID( 20 | c4d.DescLevel(1057305, 1, 465001632), # pref ID CentiLeo 21 | c4d.DescLevel(888, 133, 465001632) 22 | ) 23 | # Set 24 | return prefs[descIdSettings] 25 | 26 | def IsCentiLeoMaterial(material: c4d.BaseMaterial) -> bool: 27 | if material is None: 28 | return False 29 | return material.GetNodeMaterialReference().HasSpace(CL_NODESPACE) 30 | 31 | # 首选项设置为Node材质 32 | def IsNodeBased() -> bool: 33 | """ 34 | Check if CentiLeo use node material mode. 35 | """ 36 | return True 37 | 38 | # 获取渲染器版本 39 | def GetVersion(document: c4d.documents.BaseDocument = None) -> str : 40 | """ 41 | Get the version number of CentiLeo. 42 | 43 | Returns: 44 | str: The version number 45 | """ 46 | pass 47 | 48 | # 获取渲染器核心版本 49 | def GetCoreVersion(document: c4d.documents.BaseDocument = None) -> str : 50 | """ 51 | Get the core version of CentiLeo. 52 | 53 | Returns: 54 | str: The version number 55 | """ 56 | pass 57 | 58 | def OpenIPR(): 59 | c4d.CallCommand(1061490) # CentiLeo IPR Window 60 | 61 | # 打开材质编辑器 62 | def OpenNodeEditor(actmat: c4d.BaseMaterial = None) -> None: 63 | """ 64 | Open Node Editor for given material. 65 | """ 66 | if not actmat: 67 | doc = c4d.documents.GetActiveDocument() 68 | actmat = doc.GetActiveMaterial() 69 | else: 70 | doc = actmat.GetDocument() 71 | doc.AddUndo(c4d.UNDOTYPE_BITS,actmat) 72 | actmat.SetBit(c4d.BIT_ACTIVE) 73 | if not actmat: 74 | raise ValueError("Failed to retrieve a Material.") 75 | 76 | if Renderer.GetRenderEngine() == ID_CENTILEO: 77 | if IsNodeBased(): 78 | if not c4d.IsCommandChecked(Renderer.CID_NODE_EDITOR): 79 | c4d.CallCommand(Renderer.CID_NODE_EDITOR) # Node Editor... 80 | c4d.CallCommand(465002360) # Material 81 | else: 82 | c4d.CallCommand(1033989) # CentiLeo Shader Graph Editor 83 | # Only scroll to the material if material manager is opened 84 | 85 | if c4d.IsCommandChecked(ID_MATERIAL_MANAGER): 86 | c4d.CallCommand(16297) # Scroll To Selection 87 | 88 | # 打开材质编辑器 89 | def AovManager(document: c4d.documents.BaseDocument = None, driverType: Union[str,c4d.BaseObject,None] = None) -> None: 90 | """ 91 | Open aov Manager. 92 | """ 93 | pass 94 | 95 | # 打开贴图管理器 96 | def TextureManager() -> None: 97 | """ 98 | Open Texture Manager. 99 | """ 100 | c4d.CallCommand(1029486) 101 | 102 | # 打开灯光管理器 103 | def LightManager(): 104 | pass 105 | -------------------------------------------------------------------------------- /ChangeLog.md: -------------------------------------------------------------------------------- 1 | # Version & Updates 2 | 3 | - ### 0.1.0 4 | - old library called **renderEngine** 5 | 6 | - ### 1.0.0 7 | - Rename **renderEngine** to **Renderer** 8 | - Change the main structure to **Renderer** for more easily import and use. 9 | - Add a class **EasyTransaction** for more easily manage our node graph 10 | - Rename some class and methods might not matched with old version. 11 | - Add plugins check, if the renderer plugin is not installed, the library will not be loaded. 12 | 13 | - ### 1.0.1 14 | - Chnage the host object of AOVHelper to VideoPost(from document) 15 | - Add methods to modify octane light mask on octane tag 16 | - Fix some hint 17 | - Fix Octane Scene parameter 18 | - Update the example of AOVHelper 19 | - ### 1.0.2 20 | - Add **Vray** class 21 | - Add **Corona** class 22 | - Change VideoPost Helper __init__ parameter doc to vp 23 | - minior fixes 24 | - ### 1.0.3 25 | - Add **GetPortRealName** to fit the 2024.4.0 version. 26 | - Add **CheckArgType** and **CheckArgCallback** decorator 27 | - add some documents 28 | - ### 1.0.4 29 | - fix typing error 30 | - fix **Vray** import error 31 | - ### 1.0.5 32 | - Add **AOV** to **Vray**, you can modify aovs like other libs now. 33 | - Add **custom id** to Vray, you can check this to avoid anosing id work. 34 | 35 | - ### 1.0.6 36 | - Add **ConverterPorts** and add methods into **NodeGraghHelper**. 37 | - Add **AddShaderAfter** to **NodeGraghHelper**. 38 | - Add **IsUnique** to Octane to compare shaders 39 | - some fixes 40 | - ### 1.0.7 41 | - Add **MaterialMaker** and add methods into **PBRPackage**. 42 | - Fix some ids and json data 43 | - some fixes 44 | - ### 1.0.8 45 | - some fixes 46 | - ### 1.0.9 47 | - Add Basic **CentiLeo** Material support 48 | --- 49 | - __coming soon...__ -------------------------------------------------------------------------------- /Corona/__init__.py: -------------------------------------------------------------------------------- 1 | #!c4dpy 2 | # -*- coding: utf-8 -*- 3 | 4 | """Provides classes that expose commonly used constants as immutable objects. 5 | """ 6 | import Renderer 7 | from Renderer.constants.corona_id import * 8 | from Renderer.Corona.corona_helper import MaterialHelper as Material, AOVHelper as AOV 9 | 10 | # 获取渲染器 11 | def GetRenderEngine(document: c4d.documents.BaseDocument = None) -> int : 12 | """ 13 | Return current render engine ID. 14 | """ 15 | if not document: 16 | document = c4d.documents.GetActiveDocument() 17 | return document.GetActiveRenderData()[c4d.RDATA_RENDERENGINE] 18 | 19 | def IsCoronaMaterial(material: c4d.BaseMaterial) -> bool: 20 | if isinstance(material, c4d.BaseMaterial): 21 | if material.GetType() in Renderer.constants.ID_VALID_MATERIALS: 22 | return True 23 | return False 24 | 25 | # 打开IPR 26 | def OpenIPR() -> None: 27 | """ 28 | Open Live Viewer. 29 | """ 30 | c4d.CallCommand(1035192) # Corona VFB... 31 | # 打开材质编辑器 32 | def OpenNodeEditor(actmat: c4d.BaseMaterial = None) -> None: 33 | """ 34 | Open Node Editor for given material. 35 | """ 36 | if not actmat: 37 | doc = c4d.documents.GetActiveDocument() 38 | actmat = doc.GetActiveMaterial() 39 | 40 | elif isinstance(actmat, Material): 41 | actmat = actmat.material 42 | 43 | else: 44 | doc = actmat.GetDocument() 45 | 46 | doc.AddUndo(c4d.UNDOTYPE_BITS,actmat) 47 | actmat.SetBit(c4d.BIT_ACTIVE) 48 | 49 | if not actmat: 50 | raise ValueError("Failed to retrieve a Material.") 51 | 52 | 53 | c4d.CallCommand(1040908) # Node material editor... 54 | # Only scroll to the material if material manager is opened 55 | if c4d.IsCommandChecked(Renderer.ID_MATERIAL_MANAGER): 56 | c4d.CallCommand(16297) # Scroll To Selection 57 | 58 | # 打开aov管理器 59 | def AovManager() -> None: 60 | """ 61 | Open aov Manager. 62 | """ 63 | c4d.CallCommand(1038015) # Multi-Pass... 64 | 65 | # 打开贴图管理器 66 | def TextureManager() -> None: 67 | """ 68 | Open Octane Texture Manager. 69 | """ 70 | c4d.CallCommand(1029486) # Project Asset Inspector 71 | -------------------------------------------------------------------------------- /Octane/__init__.py: -------------------------------------------------------------------------------- 1 | #!c4dpy 2 | # -*- coding: utf-8 -*- 3 | 4 | """Provides classes that expose commonly used constants as immutable objects. 5 | """ 6 | import Renderer 7 | from Renderer.constants.octane_id import * 8 | from Renderer.Octane.octane_helper import AOVHelper as AOV, MaterialHelper as Material, SceneHelper as Scene 9 | 10 | # 获取渲染器 11 | def GetRenderEngine(document: c4d.documents.BaseDocument = None) -> int : 12 | """ 13 | Return current render engine ID. 14 | """ 15 | if not document: 16 | document = c4d.documents.GetActiveDocument() 17 | return document.GetActiveRenderData()[c4d.RDATA_RENDERENGINE] 18 | 19 | def IsOctaneMaterial(material: c4d.BaseMaterial) -> bool: 20 | if isinstance(material, c4d.BaseMaterial): 21 | if material.GetType() in Renderer.constants.OCTANE_MATERIALS: 22 | return True 23 | return False 24 | 25 | # 获取渲染器版本 26 | def GetVersion() -> str : 27 | """ 28 | Get the version number of Octane. 29 | 30 | Returns: 31 | str: The version number 32 | """ 33 | doc = c4d.documents.GetActiveDocument() 34 | OctaneDialogOpened = False 35 | 36 | def GetOctaneDialogOpened(): 37 | return OctaneDialogOpened 38 | 39 | def SetOctaneDialogOpened( value = True ): 40 | OctaneDialogOpened = value 41 | 42 | if GetRenderEngine() == ID_OCTANE_VIDEO_POST: 43 | try: 44 | bc = doc[ID_OCTANE_LIVEPLUGIN] 45 | renderer_version = bc[c4d.SET_OCTANE_VERSION] 46 | SetOctaneDialogOpened() 47 | return renderer_version 48 | except Exception as e: 49 | try: 50 | if GetOctaneDialogOpened() == False: 51 | SetOctaneDialogOpened() 52 | c4d.CallCommand(1031193) # Octane Dialog 53 | bc = doc[ID_OCTANE_LIVEPLUGIN] 54 | renderer_version = bc[c4d.SET_OCTANE_VERSION] 55 | except: 56 | renderer_version = 0 57 | else: renderer_version = 0 58 | return renderer_version 59 | 60 | # 打开IPR 61 | def OpenIPR() -> None: 62 | """ 63 | Open Live Viewer. 64 | """ 65 | c4d.CallCommand(ID_OCTANE_LIVEPLUGIN) # Octane Live Viewer Window 66 | 67 | # 打开材质编辑器 68 | def OpenNodeEditor(actmat: c4d.BaseMaterial = None) -> None: 69 | """ 70 | Open Node Editor for given material. 71 | """ 72 | if not actmat: 73 | doc = c4d.documents.GetActiveDocument() 74 | actmat = doc.GetActiveMaterial() 75 | 76 | elif isinstance(actmat, Material): 77 | actmat = actmat.material 78 | 79 | else: 80 | doc = actmat.GetDocument() 81 | 82 | doc.AddUndo(c4d.UNDOTYPE_BITS,actmat) 83 | actmat.SetBit(c4d.BIT_ACTIVE) 84 | 85 | if not actmat: 86 | raise ValueError("Failed to retrieve a Material.") 87 | 88 | 89 | c4d.CallCommand(1033872) # Octane Node Editor 90 | # Only scroll to the material if material manager is opened 91 | if c4d.IsCommandChecked(Renderer.ID_MATERIAL_MANAGER): 92 | c4d.CallCommand(16297) # Scroll To Selection 93 | 94 | # 打开aov管理器 95 | def AovManager() -> None: 96 | """ 97 | Open aov Manager. 98 | """ 99 | c4d.CallCommand(1058335) # aov Manager... 100 | 101 | # 打开贴图管理器 102 | def TextureManager() -> None: 103 | """ 104 | Open Octane Texture Manager. 105 | """ 106 | c4d.CallCommand(1035275) # Octane Texture Manager 107 | -------------------------------------------------------------------------------- /Redshift/__init__.py: -------------------------------------------------------------------------------- 1 | #!c4dpy 2 | # -*- coding: utf-8 -*- 3 | 4 | """Provides classes that expose commonly used constants as immutable objects. 5 | """ 6 | import Renderer 7 | from ..constants.redshift_id import * 8 | from ..Redshift.redshift_helper import AOVHelper as AOV, MaterialHelper as Material, SceneHelper as Scene 9 | REDSHIFT_SHADER_NETWORK = 1036224 10 | 11 | def GetPreference() -> c4d.BaseList2D: 12 | """ 13 | Get the Redshift preferenc. 14 | """ 15 | prefs = c4d.plugins.FindPlugin(ID_PREFERENCES_NODE) 16 | 17 | if not isinstance(prefs, c4d.BaseList2D): 18 | raise RuntimeError("Could not access preferences node.") 19 | 20 | descIdSettings = c4d.DescID( 21 | c4d.DescLevel(1036220, 1, 465001632), # pref ID Redshift 22 | c4d.DescLevel(888, 133, 465001632) 23 | ) 24 | # Redshift 25 | return prefs[descIdSettings] 26 | 27 | def IsRedshiftMaterial(material: c4d.BaseMaterial) -> bool: 28 | if material is None: 29 | return False 30 | return material.CheckType(REDSHIFT_SHADER_NETWORK) or material.GetNodeMaterialReference().HasSpace(Renderer.RS_NODESPACE) 31 | 32 | 33 | # 首选项设置为Node材质 34 | def IsNodeBased(): 35 | """ 36 | Check if in Redshift and use node material mode. 37 | """ 38 | return GetPreference()[c4d.PREFS_REDSHIFT_USE_NODE_MATERIALS] 39 | 40 | def SetMaterialPreview(preview_mode: int = 1): 41 | """ 42 | Set material preview mode, default to 'when render is idle'. 43 | 44 | """ 45 | prefs = c4d.plugins.FindPlugin(ID_PREFERENCES_NODE) 46 | 47 | if not isinstance(prefs, c4d.BaseList2D): 48 | raise RuntimeError("Could not access preferences node.") 49 | 50 | 51 | descIdSettings = c4d.DescID( 52 | c4d.DescLevel(1036220, 1, 465001632), # pref ID Redshift 53 | c4d.DescLevel(888, 133, 465001632) 54 | ) 55 | # Set 56 | prefsset = prefs[descIdSettings] 57 | 58 | prefsset[c4d.PREFS_REDSHIFT_MATPREVIEW_MODE] = preview_mode 59 | 60 | # 获取渲染器版本 61 | def GetVersion() -> str : 62 | """ 63 | Get the version number of Redshift. 64 | 65 | Returns: 66 | str: The version number 67 | """ 68 | try: 69 | import redshift 70 | return redshift.GetCoreVersion() 71 | except: 72 | return str(0) 73 | 74 | def OpenIPR(): 75 | try: 76 | c4d.CallCommand(1038666) # RS RenderView 77 | except: 78 | c4d.CallCommand(1038666, 1038666) # Redshift RenderView 79 | 80 | # 打开材质编辑器 81 | def OpenNodeEditor(actmat: c4d.BaseMaterial = None) -> None: 82 | """ 83 | Open Node Editor for given material. 84 | """ 85 | if not actmat: 86 | doc = c4d.documents.GetActiveDocument() 87 | actmat = doc.GetActiveMaterial() 88 | else: 89 | doc = actmat.GetDocument() 90 | doc.AddUndo(c4d.UNDOTYPE_BITS,actmat) 91 | actmat.SetBit(c4d.BIT_ACTIVE) 92 | if not actmat: 93 | raise ValueError("Failed to retrieve a Material.") 94 | 95 | if Renderer.GetRenderEngine() == ID_REDSHIFT_VIDEO_POST: 96 | if IsNodeBased(): 97 | if not c4d.IsCommandChecked(Renderer.CID_NODE_EDITOR): 98 | c4d.CallCommand(Renderer.CID_NODE_EDITOR) # Node Editor... 99 | c4d.CallCommand(465002360) # Material 100 | 101 | else: 102 | c4d.CallCommand(1036229) # Redshift Shader Graph Editor 103 | # Only scroll to the material if material manager is opened 104 | 105 | if c4d.IsCommandChecked(Renderer.ID_MATERIAL_MANAGER): 106 | c4d.CallCommand(16297) # Scroll To Selection 107 | 108 | # 打开aov管理器 109 | def AovManager() -> None: 110 | """ 111 | Open aov Manager. 112 | """ 113 | c4d.CallCommand(1038693) # Redshift AOV Manager 114 | 115 | # 打开贴图管理器 116 | def TextureManager() -> None: 117 | """ 118 | Open Redshift Texture Manager. 119 | """ 120 | c4d.CallCommand(1038683) # Redshift Asset Manager 121 | -------------------------------------------------------------------------------- /Vray/__init__.py: -------------------------------------------------------------------------------- 1 | #!c4dpy 2 | # -*- coding: utf-8 -*- 3 | 4 | """Provides classes that expose commonly used constants as immutable objects. 5 | """ 6 | import c4d 7 | import Renderer 8 | from ..constants.vray_id import * 9 | from ..Vray.vray_helper import MaterialHelper as Material, AOVHelper as AOV 10 | 11 | 12 | # 首选项设置为Node材质 13 | def IsNodeBased(material: c4d.BaseMaterial) -> bool: 14 | """ 15 | Check if is node material. 16 | """ 17 | nodeMaterial: c4d.NodeMaterial = material.GetNodeMaterialReference() 18 | if nodeMaterial.HasSpace(VR_NODESPACE): 19 | return True 20 | return False 21 | 22 | def IsVrayMaterial(material: c4d.BaseMaterial) -> bool: 23 | if material is None: 24 | return False 25 | return (material.GetType() in Renderer.constants.ID_LAYER_TYPE_MATERIAL) or material.GetNodeMaterialReference().HasSpace(VR_NODESPACE) 26 | 27 | def OpenIPR(): 28 | c4d.CallCommand(1054856) # V-Ray VFB 29 | 30 | # 打开材质编辑器 31 | def OpenNodeEditor(actmat: c4d.BaseMaterial = None) -> None: 32 | """ 33 | Open Node Editor for given material. 34 | """ 35 | if not actmat: 36 | doc = c4d.documents.GetActiveDocument() 37 | actmat = doc.GetActiveMaterial() 38 | else: 39 | doc = actmat.GetDocument() 40 | doc.AddUndo(c4d.UNDOTYPE_BITS,actmat) 41 | actmat.SetBit(c4d.BIT_ACTIVE) 42 | if not actmat: 43 | raise ValueError("Failed to retrieve a Material.") 44 | 45 | if Renderer.GetRenderEngine() == ID_VRAY: 46 | if IsNodeBased(actmat): 47 | if not c4d.IsCommandChecked(Renderer.CID_NODE_EDITOR): 48 | c4d.CallCommand(Renderer.CID_NODE_EDITOR) # Node Editor... 49 | c4d.CallCommand(465002360) # Material 50 | 51 | if c4d.IsCommandChecked(Renderer.ID_MATERIAL_MANAGER): 52 | c4d.CallCommand(16297) # Scroll To Selection 53 | 54 | # 打开aov管理器 55 | def AovManager() -> None: 56 | """ 57 | Open aov Manager. 58 | """ 59 | c4d.CallCommand(1054051) # Render Elements 60 | -------------------------------------------------------------------------------- /constants/CentiLeo.json: -------------------------------------------------------------------------------- 1 | { 2 | "com.centileo.node.bitmap":{ 3 | "input":"filename", 4 | "output":"result" 5 | }, 6 | "com.centileo.node.colorcorrect":{ 7 | "input":"input_map", 8 | "output":"result" 9 | }, 10 | "com.centileo.node.curvature":{ 11 | "input":"distance_map", 12 | "output":"result" 13 | }, 14 | "com.centileo.node.curveinfo":{ 15 | "input":"", 16 | "output":"root_uvw" 17 | }, 18 | "com.centileo.node.displacement":{ 19 | "input":"displacement_map", 20 | "output":"result" 21 | }, 22 | "com.centileo.node.emission":{ 23 | "input":"emission_color", 24 | "output":"result" 25 | }, 26 | "com.centileo.node.falloff":{ 27 | "input":"map90", 28 | "output":"result" 29 | }, 30 | "com.centileo.node.flakes":{ 31 | "input":"uvw_map", 32 | "output":"result" 33 | }, 34 | "com.centileo.node.gradientnode":{ 35 | "input":"input_map", 36 | "output":"result" 37 | }, 38 | "com.centileo.node.layer":{ 39 | "input":"color1", 40 | "output":"result" 41 | }, 42 | "com.centileo.node.material":{ 43 | "input":"diffuse_color", 44 | "output":"result" 45 | }, 46 | "com.centileo.node.material_multimix":{ 47 | "input":"material1", 48 | "output":"result" 49 | }, 50 | "com.centileo.node.material_rayswitch":{ 51 | "input":"", 52 | "output":"result" 53 | }, 54 | "com.centileo.node.materialmix":{ 55 | "input":"material1", 56 | "output":"result" 57 | }, 58 | "com.centileo.node.materialref":{ 59 | "input":"materialref", 60 | "output":"result_material" 61 | }, 62 | "com.centileo.node.math":{ 63 | "input":"math_a", 64 | "output":"result" 65 | }, 66 | "com.centileo.node.mographinfo":{ 67 | "input":"", 68 | "output":"result_id" 69 | }, 70 | "com.centileo.node.noise":{ 71 | "input":"uvw_map", 72 | "output":"result" 73 | }, 74 | "com.centileo.node.object_attrib":{ 75 | "input":"", 76 | "output":"result" 77 | }, 78 | "com.centileo.node.output":{ 79 | "input":"surface_material", 80 | "output":"" 81 | }, 82 | "com.centileo.node.particleinfo":{ 83 | "input":"", 84 | "output":"result_id" 85 | }, 86 | "com.centileo.node.pattern":{ 87 | "input":"uvw_map", 88 | "output":"result" 89 | }, 90 | "com.centileo.node.random":{ 91 | "input":"seed_map", 92 | "output":"result" 93 | }, 94 | "com.centileo.node.rayswitch":{ 95 | "input":"tex_direct", 96 | "output":"result" 97 | }, 98 | "com.centileo.node.remap":{ 99 | "input":"input_map", 100 | "output":"result" 101 | }, 102 | "com.centileo.node.scratches":{ 103 | "input":"uvw_map", 104 | "output":"result" 105 | }, 106 | "com.centileo.node.selection_mask":{ 107 | "input":"", 108 | "output":"result" 109 | }, 110 | "com.centileo.node.shuffle":{ 111 | "input":"input_map", 112 | "output":"result" 113 | }, 114 | "com.centileo.node.side":{ 115 | "input":"", 116 | "output":"result" 117 | }, 118 | "com.centileo.node.triplanar":{ 119 | "input":"uvw_projection", 120 | "output":"result" 121 | }, 122 | "com.centileo.node.user_data":{ 123 | "input":"", 124 | "output":"result" 125 | }, 126 | "com.centileo.node.uvw_distortion":{ 127 | "input":"uvw_map", 128 | "output":"result" 129 | }, 130 | "com.centileo.node.uvw_projection":{ 131 | "input":"uvw_offset", 132 | "output":"result" 133 | }, 134 | "com.centileo.node.uvw_transform":{ 135 | "input":"uvw_map", 136 | "output":"result" 137 | }, 138 | "com.centileo.node.vertex_attrib":{ 139 | "input":"", 140 | "output":"result" 141 | }, 142 | "com.centileo.node.wire":{ 143 | "input":"", 144 | "output":"result" 145 | } 146 | } -------------------------------------------------------------------------------- /constants/Vray.json: -------------------------------------------------------------------------------- 1 | { 2 | "com.chaos.vray_node.brdfalsurface":{ 3 | "input":"", 4 | "output":"com.chaos.vray_node.brdfalsurface.output.default" 5 | }, 6 | "com.chaos.vray_node.brdfbump":{ 7 | "input":"com.chaos.vray_node.brdfbump.base_brdf", 8 | "output":"com.chaos.vray_node.brdfbump.output.default" 9 | }, 10 | "com.chaos.vray_node.brdfcarpaint2":{ 11 | "input":"com.chaos.vray_node.brdfcarpaint2.base_color", 12 | "output":"com.chaos.vray_node.brdfcarpaint2.output.default" 13 | }, 14 | "com.chaos.vray_node.brdfhair4":{ 15 | "input":"", 16 | "output":"com.chaos.vray_node.brdfhair4.output.default" 17 | }, 18 | "com.chaos.vray_node.brdflayered":{ 19 | "input":"com.chaos.vray_node.brdflayered.base_material", 20 | "output":"com.chaos.vray_node.brdflayered.output.default" 21 | }, 22 | "com.chaos.vray_node.brdflight":{ 23 | "input":"com.chaos.vray_node.brdflight.color", 24 | "output":"com.chaos.vray_node.brdflight.output.default" 25 | }, 26 | "com.chaos.vray_node.brdfsss2complex":{ 27 | "input":"", 28 | "output":"com.chaos.vray_node.brdfsss2complex.output.default" 29 | }, 30 | "com.chaos.vray_node.brdfstochasticflakes":{ 31 | "input":"", 32 | "output":"com.chaos.vray_node.brdfstochasticflakes.output.default" 33 | }, 34 | "com.chaos.vray_node.brdftoonmtl":{ 35 | "input":"", 36 | "output":"com.chaos.vray_node.brdftoonmtl.output.default" 37 | }, 38 | "com.chaos.vray_node.brdfvraymtl":{ 39 | "input":"com.chaos.vray_node.brdfvraymtl.diffuse", 40 | "output":"com.chaos.vray_node.brdfvraymtl.output.default" 41 | }, 42 | "com.chaos.vray_node.colorcorrection":{ 43 | "input":"com.chaos.vray_node.colorcorrection.texture_map", 44 | "output":"com.chaos.vray_node.colorcorrection.output.default" 45 | }, 46 | "com.chaos.vray_node.float3toacolor":{ 47 | "input":"", 48 | "output":"com.chaos.vray_node.float3toacolor.output.default" 49 | }, 50 | "com.chaos.vray_node.maxon_noise":{ 51 | "input":"com.chaos.vray_node.maxon_noise.color1", 52 | "output":"com.chaos.vray_node.maxon_noise.output.default" 53 | }, 54 | "com.chaos.vray_node.mtl2sided":{ 55 | "input":"", 56 | "output":"" 57 | }, 58 | "com.chaos.vray_node.mtlmulti":{ 59 | "input":"", 60 | "output":"com.chaos.vray_node.mtlmulti.output.default" 61 | }, 62 | "com.chaos.vray_node.mtloverride":{ 63 | "input":"", 64 | "output":"com.chaos.vray_node.mtloverride.output.default" 65 | }, 66 | "com.chaos.vray_node.mtlsinglebrdf":{ 67 | "input":"", 68 | "output":"" 69 | }, 70 | "com.chaos.vray_node.mtlvrmat":{ 71 | "input":"", 72 | "output":"com.chaos.vray_node.mtlvrmat.output.default" 73 | }, 74 | "com.chaos.vray_node.texacolorchannel":{ 75 | "input":"com.chaos.vray_node.texacolorchannel.color_a", 76 | "output":"com.chaos.vray_node.texacolorchannel.output.default" 77 | }, 78 | "com.chaos.vray_node.texacolorop":{ 79 | "input":"com.chaos.vray_node.texacolorop.color_a", 80 | "output":"com.chaos.vray_node.texacolorop.output.default" 81 | }, 82 | "com.chaos.vray_node.texbitmap":{ 83 | "input":"com.chaos.vray_node.texbitmap.file", 84 | "output":"com.chaos.vray_node.texbitmap.output.default" 85 | }, 86 | "com.chaos.vray_node.texbump2glossiness":{ 87 | "input":"com.chaos.vray_node.texbump2glossiness.map", 88 | "output":"com.chaos.vray_node.texbump2glossiness.output.default" 89 | }, 90 | "com.chaos.vray_node.texcellular":{ 91 | "input":"", 92 | "output":"com.chaos.vray_node.texcellular.output.default" 93 | }, 94 | "com.chaos.vray_node.texchecker":{ 95 | "input":"", 96 | "output":"com.chaos.vray_node.texchecker.output.default" 97 | }, 98 | "com.chaos.vray_node.texclamp":{ 99 | "input":"com.chaos.vray_node.texclamp.texture", 100 | "output":"com.chaos.vray_node.texclamp.output.default" 101 | }, 102 | "com.chaos.vray_node.texcolortofloat":{ 103 | "input":"com.chaos.vray_node.texcolortofloat.input", 104 | "output":"com.chaos.vray_node.texcolortofloat.output.default" 105 | }, 106 | "com.chaos.vray_node.texcombinecolor":{ 107 | "input":"com.chaos.vray_node.texcombinecolor.color", 108 | "output":"com.chaos.vray_node.texcombinecolor.output.default" 109 | }, 110 | "com.chaos.vray_node.texcombinefloat":{ 111 | "input":"com.chaos.vray_node.texcombinefloat.value", 112 | "output":"com.chaos.vray_node.texcombinefloat.output.default" 113 | }, 114 | "com.chaos.vray_node.texcurvature":{ 115 | "input":"", 116 | "output":"com.chaos.vray_node.texcurvature.output.default" 117 | }, 118 | "com.chaos.vray_node.texdirt":{ 119 | "input":"", 120 | "output":"com.chaos.vray_node.texdirt.output.default" 121 | }, 122 | "com.chaos.vray_node.texdistance":{ 123 | "input":"", 124 | "output":"com.chaos.vray_node.texdistance.output.default" 125 | }, 126 | "com.chaos.vray_node.texedges":{ 127 | "input":"", 128 | "output":"com.chaos.vray_node.texedges.output.default" 129 | }, 130 | "com.chaos.vray_node.texfalloff":{ 131 | "input":"com.chaos.vray_node.texfalloff.color1", 132 | "output":"com.chaos.vray_node.texfalloff.output.default" 133 | }, 134 | "com.chaos.vray_node.texfloatop":{ 135 | "input":"com.chaos.vray_node.texfloatop.float_a", 136 | "output":"com.chaos.vray_node.texfloatop.output.default" 137 | }, 138 | "com.chaos.vray_node.texfloattocolor":{ 139 | "input":"com.chaos.vray_node.texfloattocolor.input", 140 | "output":"com.chaos.vray_node.texfloattocolor.output.default" 141 | }, 142 | "com.chaos.vray_node.texfresnel":{ 143 | "input":"", 144 | "output":"com.chaos.vray_node.texfresnel.output.default" 145 | }, 146 | "com.chaos.vray_node.texhairsampler":{ 147 | "input":"", 148 | "output":"" 149 | }, 150 | "com.chaos.vray_node.texinvert":{ 151 | "input":"com.chaos.vray_node.texinvert.texture", 152 | "output":"com.chaos.vray_node.texinvert.output.default" 153 | }, 154 | "com.chaos.vray_node.texinvertfloat":{ 155 | "input":"com.chaos.vray_node.texinvertfloat.texture", 156 | "output":"com.chaos.vray_node.texinvertfloat.output.default" 157 | }, 158 | "com.chaos.vray_node.texlayeredmax":{ 159 | "input":"", 160 | "output":"com.chaos.vray_node.texlayeredmax.output.default" 161 | }, 162 | "com.chaos.vray_node.texluminance":{ 163 | "input":"com.chaos.vray_node.texluminance.input", 164 | "output":"com.chaos.vray_node.texluminance.output.default" 165 | }, 166 | "com.chaos.vray_node.texmeshvertexcolorchannel":{ 167 | "input":"", 168 | "output":"com.chaos.vray_node.texmeshvertexcolorchannel.output.default" 169 | }, 170 | "com.chaos.vray_node.texmix":{ 171 | "input":"com.chaos.vray_node.texmix.color1", 172 | "output":"com.chaos.vray_node.texmix.output.default" 173 | }, 174 | "com.chaos.vray_node.texmulti":{ 175 | "input":"com.chaos.vray_node.texmulti.default_texture", 176 | "output":"com.chaos.vray_node.texmulti.output.default" 177 | }, 178 | "com.chaos.vray_node.texnoisemax":{ 179 | "input":"com.chaos.vray_node.texnoisemax.color1", 180 | "output":"com.chaos.vray_node.texnoisemax.output.default" 181 | }, 182 | "com.chaos.vray_node.texnormalbump":{ 183 | "input":"com.chaos.vray_node.texnormalbump.bump_tex_color", 184 | "output":"com.chaos.vray_node.texnormalbump.output.default" 185 | }, 186 | "com.chaos.vray_node.texocio":{ 187 | "input":"com.chaos.vray_node.texocio.basemap", 188 | "output":"com.chaos.vray_node.texocio.output.default" 189 | }, 190 | "com.chaos.vray_node.texparticlesampler":{ 191 | "input":"", 192 | "output":"" 193 | }, 194 | "com.chaos.vray_node.texramp":{ 195 | "input":"", 196 | "output":"com.chaos.vray_node.texramp.output.default" 197 | }, 198 | "com.chaos.vray_node.texremap":{ 199 | "input":"com.chaos.vray_node.texremap.input_color", 200 | "output":"com.chaos.vray_node.texremap.output.default" 201 | }, 202 | "com.chaos.vray_node.texrgbtohsv":{ 203 | "input":"", 204 | "output":"com.chaos.vray_node.texrgbtohsv.output.default" 205 | }, 206 | "com.chaos.vray_node.texsampler":{ 207 | "input":"", 208 | "output":"com.chaos.vray_node.texsampler.output.default" 209 | }, 210 | "com.chaos.vray_node.texsetrange":{ 211 | "input":"com.chaos.vray_node.texsetrange.value", 212 | "output":"com.chaos.vray_node.texsetrange.output.default" 213 | }, 214 | "com.chaos.vray_node.texsmoke":{ 215 | "input":"com.chaos.vray_node.texsmoke.color1", 216 | "output":"com.chaos.vray_node.texsmoke.output.default" 217 | }, 218 | "com.chaos.vray_node.texsoftbox":{ 219 | "input":"com.chaos.vray_node.texsoftbox.base_color", 220 | "output":"com.chaos.vray_node.texsoftbox.output.default" 221 | }, 222 | "com.chaos.vray_node.texsplat":{ 223 | "input":"com.chaos.vray_node.texsplat.color1", 224 | "output":"com.chaos.vray_node.texsplat.output.default" 225 | }, 226 | "com.chaos.vray_node.texstucco":{ 227 | "input":"com.chaos.vray_node.texstucco.color1", 228 | "output":"com.chaos.vray_node.texstucco.output.default" 229 | }, 230 | "com.chaos.vray_node.textiles":{ 231 | "input":"", 232 | "output":"com.chaos.vray_node.textiles.output.default" 233 | }, 234 | "com.chaos.vray_node.textriplanar":{ 235 | "input":"com.chaos.vray_node.textriplanar.texture_x", 236 | "output":"com.chaos.vray_node.textriplanar.output.default" 237 | }, 238 | "com.chaos.vray_node.texusercolor":{ 239 | "input":"", 240 | "output":"com.chaos.vray_node.texusercolor.output.default" 241 | }, 242 | "com.chaos.vray_node.texuserinteger":{ 243 | "input":"", 244 | "output":"com.chaos.vray_node.texuserinteger.output.default" 245 | }, 246 | "com.chaos.vray_node.texuserscalar":{ 247 | "input":"", 248 | "output":"com.chaos.vray_node.texuserscalar.output.default" 249 | }, 250 | "com.chaos.vray_node.texuvw":{ 251 | "input":"", 252 | "output":"com.chaos.vray_node.texuvw.output.default" 253 | }, 254 | "com.chaos.vray_node.texvectorproduct":{ 255 | "input":"", 256 | "output":"com.chaos.vray_node.texvectorproduct.output.default" 257 | }, 258 | "com.chaos.vray_node.uvwgenchannel":{ 259 | "input":"", 260 | "output":"com.chaos.vray_node.uvwgenchannel.output.default" 261 | }, 262 | "com.chaos.vray_node.uvwgenexplicit":{ 263 | "input":"", 264 | "output":"com.chaos.vray_node.uvwgenexplicit.output.default" 265 | }, 266 | "com.chaos.vray_node.uvwgenmayaplace2dtexture":{ 267 | "input":"", 268 | "output":"com.chaos.vray_node.uvwgenmayaplace2dtexture.output.default" 269 | }, 270 | "com.chaos.vray_node.uvwgenobject":{ 271 | "input":"", 272 | "output":"com.chaos.vray_node.uvwgenobject.output.default" 273 | }, 274 | "com.chaos.vray_node.uvwgenprojection":{ 275 | "input":"", 276 | "output":"com.chaos.vray_node.uvwgenprojection.output.default" 277 | }, 278 | "com.chaos.vray_node.uvwgenrandomizer":{ 279 | "input":"com.chaos.vray_node.uvwgenrandomizer.input", 280 | "output":"com.chaos.vray_node.uvwgenrandomizer.output.default" 281 | }, 282 | "com.chaos.vray_node.uvwgenselect":{ 283 | "input":"", 284 | "output":"com.chaos.vray_node.uvwgenselect.output.default" 285 | } 286 | } -------------------------------------------------------------------------------- /constants/__init__.py: -------------------------------------------------------------------------------- 1 | #!c4dpy 2 | # -*- coding: utf-8 -*- 3 | 4 | """Provides classes that expose commonly used constants as immutable objects. 5 | """ 6 | from Renderer.constants.common_id import * 7 | from Renderer.constants.redshift_id import * 8 | from Renderer.constants.octane_id import * 9 | from Renderer.constants.arnold_id import * 10 | from Renderer.constants.vray_id import * 11 | from Renderer.constants.corona_id import * 12 | from Renderer.constants.centileo_id import * 13 | -------------------------------------------------------------------------------- /constants/centileo_id.py: -------------------------------------------------------------------------------- 1 | ID_CENTILEO = 1036821 2 | CL_NODESPACE = "com.centileo.class.nodespace" 3 | 4 | ID_LIGHT_TAG = 1036817 5 | ID_ENV_TAG = 1036818 6 | ID_OBJECT_TAG = 1039221 7 | ID_CAMERA_TAG = 1036826 8 | -------------------------------------------------------------------------------- /constants/common_id.py: -------------------------------------------------------------------------------- 1 | import c4d 2 | import typing 3 | from typing import Union, Optional 4 | import maxon 5 | 6 | ### ========== Ids ========== ### 7 | 8 | # VideoPost 9 | ID_OCTANE: int = 1029525 # Octane 10 | ID_REDSHIFT: int = 1036219 # Redshift 11 | ID_ARNOLD: int = 1029988 # Arnold 12 | ID_VRAY: int = 1053272 13 | ID_CORONA: int = 1030480 14 | ID_LOOKS: int = 1054755 15 | ID_CENTILEO: int = 1036821 16 | 17 | 18 | # Buildin ID 19 | ID_PREFERENCES_NODE = 465001632 # Prefs ID 20 | CID_ASSET_BROWSER = 1054225 # Asset Browser 21 | ID_MATERIAL_MANAGER: int = 12159 # Material Manager 22 | CID_NODE_EDITOR: int = 465002211 # Node Editor 23 | 24 | # redshift 25 | RS_NODESPACE: str = "com.redshift3d.redshift4c4d.class.nodespace" 26 | RS_SHADER_PREFIX: str = "com.redshift3d.redshift4c4d.nodes.core." 27 | 28 | # arnold 29 | AR_NODESPACE: str = "com.autodesk.arnold.nodespace" 30 | AR_SHADER_PREFIX: str = "com.autodesk.arnold.shader." 31 | 32 | STANDARD_NODESPACE: str = "net.maxon.nodespace.standard" 33 | VR_NODESPACE: str = "com.chaos.class.vray_node_renderer_nodespace" 34 | 35 | CL_NODESPACE: str = "com.centileo.class.nodespace" 36 | 37 | ARNOLD_SHADER_NETWORK = 1033991 38 | REDSHIFT_SHADER_NETWORK = 1036224 39 | 40 | # data types 41 | DATATYPE_INT: maxon.Id = maxon.Id("int64") 42 | DATATYPE_COL3: maxon.Id = maxon.Id("net.maxon.parametrictype.col<3,float64>") 43 | DATATYPE_FLOAT64: maxon.Id = maxon.Id("float64") 44 | 45 | # align 46 | ALIGNALLNODES: int = 465002363 47 | ALIGNNODES: int = 465002311 48 | # new at R2025 49 | ALIGNBOTTOM: int = 1063229 50 | ALIGNTOP: int = 1063227 51 | ALIGNLEFT: int = 1063230 52 | ALIGNRIGHT: int = 1063232 53 | ALIGNCENTERV: int = 1063228 54 | ALIGNCENTERH: int = 1063231 -------------------------------------------------------------------------------- /constants/corona_id.py: -------------------------------------------------------------------------------- 1 | 2 | import c4d 3 | 4 | ID_PREFERENCES_NODE = 465001632 # Prefs ID 5 | ID_CORONA = 1030480 6 | 7 | CR_COLORSPACE_SRGB: int = 2 8 | CR_COLORSPACE_LINEAR: int = 1 9 | 10 | CORONA_MENU_MAIN_MENU = 1038214 11 | CORONA_MENU_SKYOBJECT = 1053478 12 | CORONA_MENU_CORONACAMERA = 1032262 13 | CORONA_MENU_CORONAHAIR = 1038387 14 | CORONA_MENU_CHAOSSCATTER = 1061050 15 | CORONA_MENU_MULTIPASS = 1038015 16 | CORONA_MENU_VFB = 1035192 17 | CORONA_MENU_MATERIAL_LIBRARY = 1056698 18 | CORONA_MENU_COSMOS_BROWSER = 1058854 19 | CORONA_MENU_INTERACTIVE = 1034465 20 | CORONA_MENU_INTERACTIVE_VIEWPORT = 1052867 21 | CORONA_MENU_CONVERT = 1032098 22 | CORONA_MENU_NODE_SYSTEM = 1040908 23 | CORONA_MENU_PREFERENCES = 1032097 24 | CORONA_MENU_HELP = 1032099 25 | CORONA_MENU_ABOUT = 1032096 26 | CORONA_MENU_LISTER = 1060597 27 | 28 | # Material menu 29 | CORONA_MENU_MATERIALS_MENU = 1038215 30 | CORONA_MENU_MATERIAL_NEW = 1038378 31 | CORONA_MENU_MATERIAL_LAYERED = 1038379 32 | CORONA_MENU_MATERIAL_SELECT = 1052987 33 | CORONA_MENU_MATERIAL_LIGHT = 1038381 34 | CORONA_MENU_MATERIAL_VOLUME = 1038382 35 | CORONA_MENU_MATERIAL_RAYSWITCH = 1038383 36 | CORONA_MENU_MATERIAL_SHADOWCATCHER = 1038384 37 | CORONA_MENU_MATERIAL_SKIN = 1038385 38 | CORONA_MENU_MATERIAL_HAIR = 1038386 39 | CORONA_MENU_MATERIAL_PHYSICAL = 1056322 40 | CORONA_MENU_MATERIAL_SLICER = 1058724 41 | CORONA_MENU_MATERIAL_SCANNED = 1060063 42 | 43 | # Picture viewer menu 44 | CORONA_MENU_PV_MENU = 1038217 45 | CORONA_MENU_PV_POSTPROCESS = 1032095 46 | CORONA_MENU_DUMP_EXR = 1039041 47 | CORONA_MENU_RESUME_FILE = 1039042 48 | CORONA_MENU_RESUME_LAST = 1039040 49 | 50 | # When adding material editor menu entries update 51 | # _PLUGINID_CORONA4D_NODESYSTEM_MENU_LAST in nodesystem.h to register it 52 | 53 | # Node material editor menu [Create] 54 | CORONA_MENU_NODESYSTEM_ADD_EXISTING = 1041608 55 | 56 | # Node material editor menu [View] 57 | CORONA_MENU_NODESYSTEM_CREATE_VIEW = 1041596 58 | CORONA_MENU_NODESYSTEM_RENAME_VIEW = 1041597 59 | CORONA_MENU_NODESYSTEM_DELETE_VIEW = 1041598 60 | CORONA_MENU_NODESYSTEM_SHOW_ALL_PREVIEWS = 1041599 61 | CORONA_MENU_NODESYSTEM_HIDE_ALL_PREVIEWS = 1041600 62 | CORONA_MENU_NODESYSTEM_SHOW_ALL_PORTS = 1041601 63 | CORONA_MENU_NODESYSTEM_HIDE_ALL_PORTS = 1041602 64 | CORONA_MENU_NODESYSTEM_FIT_TO_SCREEN = 1041603 65 | CORONA_MENU_NODESYSTEM_ADD_ALL_CONNECTIONS = 1041604 66 | CORONA_MENU_NODESYSTEM_SORT_ALL_NODES = 1041605 67 | CORONA_MENU_NODESYSTEM_REMOVE_UNUSED_SHADERS = 1041606 68 | CORONA_MENU_NODESYSTEM_REMOVE_UNUSED_MATERIALS = 1041607 69 | 70 | # Node material editor menu [Node] 71 | CORONA_MENU_NODESYSTEM_HIDE_BODY = 1041609 72 | CORONA_MENU_NODESYSTEM_HIDE_PREVIEW = 1041610 73 | CORONA_MENU_NODESYSTEM_ADD_CONNECTIONS = 1041611 74 | CORONA_MENU_NODESYSTEM_ADD_PORT_CONNECTIONS = 1041612 75 | CORONA_MENU_NODESYSTEM_SORT_SELECTED_NODES = 1041613 76 | CORONA_MENU_NODESYSTEM_REMOVE_FROM_VIEW = 1041614 77 | CORONA_MENU_NODESYSTEM_DELETE = 1041615 78 | 79 | # Node material editor menu [Tools] 80 | CORONA_MENU_NODESYSTEM_SAVE_UNSHARED_DOCUMENT_CLONE = 1041616 81 | 82 | # 83 | # Plugin names 84 | # 85 | 86 | # Objects 87 | CORONA_OBJECT_CORONASUN = 1032153 88 | CORONA_OBJECT_CORONALIGHT = 1032104 89 | CORONA_OBJECT_CORONAPROXY = 1035544 90 | CORONA_OBJECT_CORONAVOLUMEGRID = 1055637 91 | CORONA_OBJECT_CORONADECAL = 1058613 92 | CORONA_OBJECT_CORONAPATTERN = 1058600 93 | 94 | # Materials 95 | 96 | # Tags 97 | CORONA_TAG_COMPOSITING = 1036017 98 | CORONA_TAG_CAMERA = 1032177 99 | CORONA_TAG_HAIR = 1041495 100 | CORONA_TAG_SKYMATERIAL = 1032101 101 | CORONA_TAG_RENDERSPLINE = 1059943 102 | CORONA_TAG_DISPLACEMENTMODIFIER = 1060181 103 | 104 | # Menu strings 105 | CORONA_STR_MENU_PROXYEXPORTER = 1036396 106 | CORONA_STR_MENU_CDOEXPORTER = 1056572 107 | 108 | CORONA_STR_PREFERENCES = 1035133 109 | 110 | # Plugins strings 111 | CORONA_STR_CORONA = 1030480 112 | CORONA_STR_MATERIAL = 1032100 113 | CORONA_STR_MATERIAL_LAYERED = 1035110 114 | CORONA_STR_MATERIAL_SELECT = 1052986 115 | CORONA_STR_MATERIAL_ENVIROPORTAL = 1035108 116 | CORONA_STR_MATERIAL_EXTERNAL = 1035321 117 | CORONA_STR_MATERIAL_LIGHT = 1035372 118 | CORONA_STR_MATERIAL_SHADOWCATCHER = 1039477 119 | CORONA_STR_MATERIAL_VOLUME = 1035373 120 | CORONA_STR_MATERIAL_RAYSWITCH = 1036210 121 | CORONA_STR_MATERIAL_SKIN = 1040777 122 | CORONA_STR_MATERIAL_HAIR = 1039479 123 | CORONA_STR_MATERIAL_PHYSICAL = 1056306 124 | CORONA_STR_MATERIAL_SLICER = 1058679 125 | CORONA_STR_MATERIAL_SCANNED = 1060061 126 | CORONA_STR_HOOKS = 1033701 127 | CORONA_STR_NODEMATERIALSHOOK = 1040750 128 | CORONA_STR_MULTIPASS = 1033700 129 | CORONA_STR_AOSHADER = 1034433 130 | CORONA_STR_WIRESHADER = 1035273 131 | CORONA_STR_ROUNDEDGESSHADER = 1036079 132 | CORONA_STR_NORMALSHADER = 1035405 133 | CORONA_STR_CORONABITMAPSHADER = 1036473 134 | CORONA_STR_RAYSWITCHSHADER = 1036209 135 | CORONA_STR_CORONAOUTPUT = 1038518 136 | CORONA_STR_MULTIPASSHOOK = 1037467 137 | CORONA_STR_CORONACOLORMIX = 1039043 138 | CORONA_STR_TONEMAPCONTROL = 1040816 139 | CORONA_STR_SHAREDSHADER = 1040749 140 | CORONA_STR_SHADERCONTROLNODE = 1040751 141 | CORONA_STR_TRIPLANARSHADER = 1040739 142 | CORONA_STR_MAPPINGRANDOMIZER = 1041091 143 | CORONA_STR_SELECTSHADER = 1052988 144 | CORONA_STR_MULTISHADER = 1052989 145 | CORONA_STR_SKYSHADER = 1053507 146 | CORONA_STR_DISTANCESHADER = 1055348 147 | CORONA_STR_IMPORTEDSHADER = 1057042 148 | CORONA_STR_MIXTURESHADER = 1057236 149 | CORONA_STR_CURVATURESHADER = 1058584 150 | CORONA_STR_DATASHADER = 1059068 151 | CORONA_STR_POSTPROCESS_OPERATOR_NODE = 1057356 152 | CORONA_STR_EDGESHADER = 1058243 153 | CORONA_STR_TILESHADER = 1061844 154 | 155 | ID_VALID_MATERIALS = [ 156 | CORONA_STR_MATERIAL_PHYSICAL, 157 | CORONA_STR_MATERIAL, 158 | CORONA_STR_MATERIAL_LAYERED, 159 | CORONA_STR_MATERIAL_SELECT, 160 | CORONA_STR_MATERIAL_SKIN, 161 | CORONA_STR_MATERIAL_HAIR, 162 | CORONA_STR_MATERIAL_LIGHT, 163 | CORONA_STR_MATERIAL_RAYSWITCH, 164 | CORONA_STR_MATERIAL_SHADOWCATCHER, 165 | CORONA_STR_MATERIAL_VOLUME, 166 | CORONA_STR_MATERIAL_SLICER, 167 | CORONA_STR_MATERIAL_SCANNED 168 | ] 169 | 170 | # Questions and messages 171 | CORONA_STR_CONFIRM_RESET = 1550 172 | CORONA_STR_CONFIRM_STAMP_RESET = 1551 173 | CORONA_STR_MSG_STAMP_HELP = 1552 174 | CORONA_STR_EMPTY_SHADER = 1553 175 | # CORONA_STR_SELECT_SHARED_SHADER = 1554 176 | CORONA_STR_LEGACY_BACKWARD_DLG_TITLE = 1558 177 | CORONA_STR_LEGACY_BACKWARD_DLG_TEXT = 1559 178 | CORONA_STR_LEGACY_BACKWARD_DLG_SWITCH = 1560 179 | CORONA_STR_LEGACY_BACKWARD_DLG_CANCEL = 1561 180 | CORONA_STR_LEGACY_BACKWARD_DLG_SWITCH_ALL = 1566 181 | CORONA_STR_LEGACY_BACKWARD_DLG_CANCEL_ALL = 1567 182 | CORONA_STR_LEGACY_BACKWARD_DLG_CONFIRM = 1568 183 | CORONA_STR_LEGACY_DISPLACEMENT_TITLE = 1570 184 | CORONA_STR_LEGACY_DISPLACEMENT_TEXT = 1571 185 | CORONA_STR_LEGACY_MEDIUM_RESOLVING_TITLE = 1572 186 | CORONA_STR_LEGACY_MEDIUM_RESOLVING_TEXT = 1573 187 | CORONA_STR_LEGACY_LIGHT_INSTANCES_TITLE = 1574 188 | CORONA_STR_LEGACY_LIGHT_INSTANCES_TEXT = 1575 189 | CORONA_STR_LEGACY_DISPLACEMENT_STACKING_TITLE = 1576 190 | CORONA_STR_LEGACY_DISPLACEMENT_STACKING_TEXT = 1577 191 | CORONA_STR_XREF_GENERATOR_QUESTION = 1562 192 | CORONA_STR_XREF_GENERATOR_ERROR = 1563 193 | CORONA_STR_XREF_GENERATOR_CANCEL = 1564 194 | CORONA_STR_XREF_GENERATOR_CONVERT = 1565 195 | CORONA_STR_NODESYSTEM_SAVE_UNSHARED_DOCUMENT_CLONE_VER_UNSUPPORTED = 1053957 196 | CORONA_STR_NODESYSTEM_SAVE_UNSHARED_DOCUMENT_CLONE_INFO = 1035958 197 | CORONA_STR_LIGHTSELECT_MULTIPLE_REST_WARNING = 1578 198 | CORONA_STR_CONFIRM_PRESET_CHANGE = 1579 199 | CORONA_STR_DISPLACEMENT_STACKING_UNSUPPORTED_WARNING= 1580 200 | 201 | CORONA_MULTIPASS_BASE_NAME = 10100 202 | CORONA_MULTIPASS_BASE_TYPE = 10101 203 | CORONA_MULTIPASS_BASE_TYPE_NAME = 10102 204 | CORONA_MULTIPASS_BASE_ENABLE = 10103 205 | CORONA_MULTIPASS_BASE_ANTIALIASED = 10105 206 | CORONA_MULTIPASS_BASE_DENOISE = 10106 207 | CORONA_MULTIPASS_BASE_PROPAGATE = 10107 208 | CORONA_MULTIPASS_ID_PROPERTIES = 10110 209 | 210 | CORONA_MULTIPASS_AOV = 1033780 211 | 212 | CORONA_MULTIPASS_TYPE_INVALID = -1 213 | 214 | # Basic passes 215 | CORONA_MULTIPASS_TYPE_DIRECT = 1 216 | CORONA_MULTIPASS_TYPE_EMISSION = 2 217 | CORONA_MULTIPASS_TYPE_INDIRECT = 3 218 | CORONA_MULTIPASS_TYPE_REFLECT = 4 219 | CORONA_MULTIPASS_TYPE_REFRACT = 5 220 | CORONA_MULTIPASS_TYPE_TRANSLUCENCY = 6 221 | CORONA_MULTIPASS_TYPE_VOLUMETRICS = 25 222 | 223 | # Geometry passes 224 | CORONA_MULTIPASS_TYPE_NORMALSDOTPRODUCT = 7 225 | CORONA_MULTIPASS_TYPE_NORMALSGEOMETRY = 8 226 | CORONA_MULTIPASS_TYPE_NORMALSSHADING = 9 227 | CORONA_MULTIPASS_TYPE_UVWCOORDS = 10 228 | CORONA_MULTIPASS_TYPE_WORLDPOSITION = 11 229 | CORONA_MULTIPASS_TYPE_ZDEPTH = 12 230 | CORONA_MULTIPASS_TYPE_NORMALSDISCREPANCY = 26 231 | CORONA_MULTIPASS_TYPE_PRIMITIVECOORDS = 27 232 | CORONA_MULTIPASS_TYPE_VELOCITY = 28 233 | 234 | # Info passes 235 | CORONA_MULTIPASS_TYPE_SAMPLINGFOCUS = 32 236 | CORONA_MULTIPASS_TYPE_RENDERSTAMP = 33 237 | 238 | # Mask passes 239 | CORONA_MULTIPASS_TYPE_ID = 13 240 | CORONA_MULTIPASS_TYPE_MASK = 14 241 | CORONA_MULTIPASS_TYPE_WIRECOLOR = 15 242 | CORONA_MULTIPASS_TYPE_CRYPTOMATTE = 34 243 | 244 | # Shading passes 245 | CORONA_MULTIPASS_TYPE_ALBEDO = 16 246 | CORONA_MULTIPASS_TYPE_ALPHA = 17 247 | CORONA_MULTIPASS_TYPE_COMPONENTS = 18 248 | CORONA_MULTIPASS_TYPE_RAWCOMPONENT = 19 249 | CORONA_MULTIPASS_TYPE_SHADOWS = 20 250 | CORONA_MULTIPASS_TYPE_SOURCECOLOR = 21 251 | CORONA_MULTIPASS_TYPE_BLOOMGLARE = 29 252 | CORONA_MULTIPASS_TYPE_VIRTUALBEAUTY = 30 253 | CORONA_MULTIPASS_TYPE_CAUSTICS = 31 254 | 255 | # LightMix 256 | CORONA_MULTIPASS_TYPE_LIGHTMIX = 23 257 | CORONA_MULTIPASS_TYPE_LIGHTSELECT = 24 258 | 259 | # Other passes 260 | CORONA_MULTIPASS_TYPE_TEXMAP = 22 261 | 262 | # Special value for folder 263 | CORONA_MULTIPASS_TYPE_FOLDER = 999 264 | 265 | # Legacy types (not used anymore) 266 | _CORONA_MULTIPASS_TYPE_BEAUTY = 0 267 | 268 | AOV_NAME_MAP = { 269 | 1: 'Direct', 270 | 2: 'Emission', 271 | 3: 'Indirect', 272 | 4: 'Reflect', 273 | 5: 'Refract', 274 | 6: 'Translucency', 275 | 7: 'NormalsDotProduct', 276 | 8: 'NormalsGeometry', 277 | 9: 'NormalsShading', 278 | 10: 'UvwCoords', 279 | 11: 'WorldPosition', 280 | 12: 'ZDepth', 281 | 13: 'ID', 282 | 14: 'Mask0', 283 | 15: 'WireColor', 284 | 16: 'Albedo', 285 | 17: 'Alpha', 286 | 18: 'Components', 287 | 19: 'RawComponent', 288 | 20: 'Shadows', 289 | 21: 'SourceColor', 290 | 22: 'Texmap', 291 | 23: 'LightMix0', 292 | 24: 'LightSelect', 293 | 25: 'Volumetrics', 294 | 26: 'NormalsDiscrepancy', 295 | 27: 'PrimitiveCoords', 296 | 28: 'Velocity', 297 | 29: 'BloomGlare', 298 | 30: 'VirtualBeauty', 299 | 31: 'Caustics', 300 | 32: 'SamplingFocus', 301 | 33: 'RenderStamp', 302 | 34: 'Cryptomatte', 303 | 999: 'Folder' 304 | } 305 | -------------------------------------------------------------------------------- /constants/descriptions/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DunHouGo/renderEngine/44ca8f927b6594f294ed0c5061c26ca781dd02e7/constants/descriptions/__init__.py -------------------------------------------------------------------------------- /constants/descriptions/color_correction.py: -------------------------------------------------------------------------------- 1 | 2 | 3 | PORT_CC_INPUT = [ 4 | "com.redshift3d.redshift4c4d.nodes.core.rscolorcorrection.input", 5 | "in", 6 | "" 7 | ] 8 | 9 | PORT_CC_GAMMA = [ 10 | "com.redshift3d.redshift4c4d.nodes.core.rscolorcorrection.gamma", 11 | "gamma", 12 | "" 13 | ] 14 | 15 | PORT_CC_CONTRAST = [ 16 | "com.redshift3d.redshift4c4d.nodes.core.rscolorcorrection.contrast", 17 | "contrast", 18 | "" 19 | ] 20 | 21 | PORT_CC_HUE = [ 22 | "com.redshift3d.redshift4c4d.nodes.core.rscolorcorrection.hue", 23 | "hue_shift", 24 | "" 25 | ] 26 | 27 | PORT_CC_SATURATION = [ 28 | "com.redshift3d.redshift4c4d.nodes.core.rscolorcorrection.saturation", 29 | "saturation", 30 | "" 31 | ] 32 | 33 | PORT_CC_BRIGHTNESS = [ 34 | "com.redshift3d.redshift4c4d.nodes.core.rscolorcorrection.level", 35 | "exposure", 36 | "" 37 | ] 38 | 39 | CC_PORTS = [ 40 | PORT_CC_INPUT, 41 | PORT_CC_GAMMA, 42 | PORT_CC_CONTRAST, 43 | PORT_CC_HUE, 44 | PORT_CC_SATURATION, 45 | PORT_CC_BRIGHTNESS 46 | ] 47 | 48 | COLOR_CORRECT_DESCRIPTION = [ 49 | "com.redshift3d.redshift4c4d.nodes.core.rscolorcorrection", 50 | "com.autodesk.arnold.shader.color_correct", 51 | "com.chaos.vray_node.colorcorrection", 52 | "com.centileo.node.colorcorrect", 53 | CC_PORTS 54 | ] -------------------------------------------------------------------------------- /constants/descriptions/image.py: -------------------------------------------------------------------------------- 1 | 2 | 3 | PORT_IMAGE_INPUT = [ 4 | "Image/Filename/Path", 5 | "filename", 6 | "", 7 | "" 8 | ] 9 | 10 | PORT_IMAGE_SPACE = [ 11 | "Image/Filename/Color Space", 12 | "color_space", 13 | "", 14 | "" 15 | ] 16 | 17 | IAMGE_PORTS = [ 18 | PORT_IMAGE_INPUT, 19 | PORT_IMAGE_SPACE 20 | ] 21 | 22 | TEXTURE_DESCRIPTION = [ 23 | "com.redshift3d.redshift4c4d.nodes.core.texturesampler", 24 | "com.autodesk.arnold.shader.image", 25 | "com.chaos.vray_node.texbitmap", 26 | "com.centileo.node.bitmap", 27 | IAMGE_PORTS 28 | ] -------------------------------------------------------------------------------- /constants/descriptions/output.py: -------------------------------------------------------------------------------- 1 | 2 | 3 | ### Port descriptions 4 | 5 | PORT_OUTPUT_SHADER = [ 6 | "com.redshift3d.redshift4c4d.node.output.surface", 7 | "shader", 8 | "", 9 | "" 10 | ] 11 | 12 | PORT_OUTPUT_DISPLACEMENT = [ 13 | "com.redshift3d.redshift4c4d.node.output.displacement", 14 | "displacement", 15 | "", 16 | "" 17 | ] 18 | 19 | OUTPUT_PORTS = [ 20 | PORT_OUTPUT_SHADER, 21 | PORT_OUTPUT_DISPLACEMENT 22 | ] 23 | 24 | OUTPUT_DESCRIPTION = [ 25 | "com.redshift3d.redshift4c4d.node.output", 26 | "com.autodesk.arnold.material", 27 | ["com.chaos.vray_node.mtlsinglebrdf", "com.chaos.vray_node.mtl2sided"], 28 | "com.centileo.node.output", 29 | OUTPUT_PORTS 30 | ] -------------------------------------------------------------------------------- /constants/octane_id.py: -------------------------------------------------------------------------------- 1 | import c4d 2 | 3 | 4 | DiffuseName = "Diffuse" 5 | GlossyName = "Glossy" 6 | SpecularName = "Specular" 7 | UniversalName = "Universal" 8 | MetallicName = "Metallic" 9 | ToonName = "Toon" 10 | 11 | SUBMaterialNodeID = 1040369 12 | 13 | 14 | SET_RENDERAOV_IN_CNT=3700 15 | SET_RENDERAOV_INPUT_0=3740 16 | 17 | ID_OCTANE_VIDEO_POST = 1029525 # octane render 18 | ID_OCTANE_RENDERPASS_AOV = 1057006 # pass 19 | VP_BUFFER_TYPE = 1010 20 | VP_COLOR_SPACE = 1028 21 | # RenderPassAOV_h 22 | RNDAOV_NAME=900 23 | RNDAOV_ENABLED=994 24 | RNDAOV_TYPE=995 25 | RNDAOV_TYPE_NAME=1101 26 | 27 | RNDAOV_DIFFUSE=188 28 | RNDAOV_DIF_FILTER=191 29 | RNDAOV_REFLECTION=222 30 | RNDAOV_REFL_FILTER=225 31 | RNDAOV_REFRACT_FILTER=230 32 | RNDAOV_TRANSM_FILTER=242 33 | RNDAOV_TEX_TANGENT=240 34 | RNDAOV_UVSET=3459 35 | RNDAOV_CRYPTOMATTE=185 36 | 37 | RNDAOV_EMIT=196 38 | RNDAOV_ENV=197 39 | RNDAOV_DIF_D=189 40 | RNDAOV_DIF_I=193 41 | RNDAOV_REFL_D=223 42 | RNDAOV_REFL_I=227 43 | RNDAOV_REFRACT=229 44 | RNDAOV_TRANS=244 45 | RNDAOV_SSS=238 46 | RNDAOV_POST=221 47 | RNDAOV_NOISE=212 48 | RNDAOV_SHADOW=237 49 | RNDAOV_LAYER_BLACKSHD=202 50 | RNDAOV_LAYER_COLORSHD=204 51 | RNDAOV_LAYER_REFLECTION=203 52 | 53 | RNDAOV_POST_INCLUDE_ENV=3325 54 | RNDAOV_IRRADIANCE=201 55 | RNDAOV_LIGHT_DIRECTION=207 56 | RNDAOV_VOLUME=246 57 | RNDAOV_VOLUME_MASK=250 58 | RNDAOV_VOLUME_EMISSION=248 59 | RNDAOV_VOLUME_Z_DEPTH_FRONT=251 60 | RNDAOV_VOLUME_Z_DEPTH_BACK=252 61 | RNDAOV_CUSTOM=186 62 | RNDAOV_GLOBALTEX=199 63 | RNDAOV_CUSTOM_IDS=3390 64 | RNDAOV_VISIBLE_AFTER=3391 65 | RNDAOV_ZDEPTH_MAX=3392 66 | RNDAOV_ZDEPTH_ENVDEPTH=3397 67 | RNDAOV_UVMAX=3393 68 | RNDAOV_MAXSPEED=3394 69 | RNDAOV_AODIST=3395 70 | RNDAOV_AOALPHASHD=3396 71 | RNDAOV_WIRE_SHADING=3398 72 | RNDAOV_WIRE_BMPNRML_MAP=3399 73 | RNDAOV_WIRE_HGLTBACK=3400 74 | 75 | RNDAOV_GEONORM=198 76 | RNDAOV_SHDNORM=236 77 | RNDAOV_SMOOTHNORM=253 78 | RNDAOV_POSITION=220 79 | RNDAOV_ZDEPTH=255 80 | RNDAOV_MATID=210 81 | RNDAOV_UV_COORD=245 82 | RNDAOV_TANGENT=239 83 | RNDAOV_WIRE=254 84 | RNDAOV_OBJECT_ID=217 85 | RNDAOV_AO=183 86 | RNDAOV_MOTION_VECTOR=211 87 | RNDAOV_RENDER_LAYER_ID=233 88 | RNDAOV_RENDER_LAYER_MASK=234 89 | RNDAOV_FSIZE=3347 90 | RNDAOV_LIGHT_PASS_ID=209 91 | RNDAOV_OBJECT_LAYER_COLOR=218 92 | RNDAOV_BAKEGROUP_ID=184 93 | RNDAOV_SMOOTHNORM_N=3442 94 | RNDAOV_TANGENT_N=3446 95 | RNDAOV_GEONORM_N=3440 96 | RNDAOV_SHDNORM_N=3441 97 | RNDAOV_POSITION_N=3443 98 | RNDAOV_ZDEPTH_N=3444 99 | RNDAOV_UV_COORD_N=3445 100 | RNDAOV_MOT_VECTOR_N=3447 101 | RNDAOV_TEX_TANGENT_N=3448 102 | 103 | RNDAOV_DISTR_PT=3350 104 | RNDAOV_DIST_TRACING=3351 105 | RNDAOV_BEAUTY_DENOISER=3380 106 | RNDAOV_DENOISER_DIFFUSE_D=190 107 | RNDAOV_DENOISER_DIFFUSE_I=194 108 | RNDAOV_DENOISER_REFLECT_D=224 109 | RNDAOV_DENOISER_REFLECT_I=228 110 | RNDAOV_DENOISER_REFRACTION=3385 111 | RNDAOV_DENOISER_REMAINDER=232 112 | RNDAOV_DENOISER_EMISSION=195 113 | RNDAOV_DENOISER_VOLUME=247 114 | RNDAOV_DENOISER_VOL_EMIS=249 115 | 116 | RNDAOV_INFO_OPACITY=219 117 | RNDAOV_INFO_ROUGHNESS=235 118 | RNDAOV_INFO_DIFFUSE=192 119 | RNDAOV_INFO_REFLECTION=3364 120 | RNDAOV_INFO_REFL_FILTER=226 121 | RNDAOV_INFO_REFRACTION=3365 122 | RNDAOV_INFO_REFRACT_FILTER=231 123 | RNDAOV_INFO_IOR=200 124 | RNDAOV_INFO_TRANSMISSON=243 125 | RNDAOV_RAW=3450 126 | RNDAOV_LIGHT=205 127 | RNDAOV_LIGHT_D=206 128 | RNDAOV_LIGHT_I=208 129 | RNDAOV_CRYPTO_TYPE=1821 130 | RNDAOV_LIGHT_ID=1822 131 | 132 | ID_OCTANE_BASE_MATERIAL = 1029501 133 | ID_OCTANE_STANDARD_SURFACE = 1058763 134 | ID_OCTANE_COMPOSITE_MATERIAL = 1040075 135 | ID_OCTANE_MIX_MATERIAL = 1029622 136 | ID_OCTANE_PORTAL_MATERIAL = 1029623 137 | ID_OCTANE_CLIPPING_MATERIAL = 1056989 138 | ID_OCTANE_SHADOWCATCHER_MAT = 1057003 139 | ID_OCTANE_HAIR_MATERIAL = 1054119 140 | OCTANE_MATERIALS = [ID_OCTANE_BASE_MATERIAL, 141 | ID_OCTANE_STANDARD_SURFACE, 142 | ID_OCTANE_MIX_MATERIAL, 143 | ID_OCTANE_PORTAL_MATERIAL, 144 | ID_OCTANE_CLIPPING_MATERIAL, 145 | ID_OCTANE_SHADOWCATCHER_MAT, 146 | ID_OCTANE_HAIR_MATERIAL, 147 | ID_OCTANE_COMPOSITE_MATERIAL 148 | ] 149 | 150 | 151 | MAT_TYPE_DIFFUSE = 2510 152 | MAT_TYPE_GLOSSY = 2511 153 | MAT_TYPE_SPECULAR = 2513 154 | MAT_TYPE_METALLIC = 2514 155 | MAT_TYPE_TOON = 2515 156 | MAT_TYPE_UNIVERSAL = 2516 157 | 158 | BRDF_OCTANE = 0 159 | BRDF_GGX = 2 160 | BRDF_GGX_EP = 6 161 | 162 | # Node IDs for Octane nodes 163 | ID_OCTANE_FLOAT_TEXTURE = 1029506 164 | ID_OCTANE_IMAGE_TEXTURE = 1029508 165 | ID_OCTANE_RGBSPECTRUM = 1029504 166 | 167 | ID_OCTANE_MULTIPLY_TEXTURE = 1029516 168 | ID_OCTANE_SUBTRACT_TEXTURE = 1038878 169 | ID_OCTANE_INVERT_TEXTURE = 1029514 170 | ID_OCTANE_ADD_TEXTURE = 1038877 171 | ID_OCTANE_MIXTEXTURE = 1029505 172 | 173 | ID_OCTANE_COLORCORRECTION = 1029512 174 | ID_OCTANE_GRADIENT_TEXTURE = 1029513 175 | ID_OCTANE_CLAMP_TEXTURE = 1029511 176 | ID_INSTANCE_RANGE_TEXTURE = 1039376 177 | ID_OCTANE_FALLOFFMAP = 1029503 178 | ID_OCTANE_DIRT_TEXTURE = 1029975 179 | ID_OCTANE_CURVATURE_TEX = 1057004 180 | ID_OCTANE_C4DNOISE_TEX = 1058853 181 | ID_OCTANE_NOISE_TEXTURE = 1033698 182 | 183 | ID_OCTANE_TRIPLANAR = 1038882 184 | ID_OCTANE_TRANSFORM = 1030961 185 | ID_OCTANE_DISPLACEMENT = 1031901 186 | ID_OCTANE_TEXTURE_PROJECTION = 1031460 187 | ID_OCTANE_BLACKBODY_EMISSION = 1029641 188 | ID_OCTANE_TEXTURE_EMISSION = 1029642 189 | 190 | ID_OCTANE_LIVEPLUGIN = 1029499 # Octane Live Viewer 191 | ID_OCTANE_CAMERATAG = 1029524 # Octane Camera Tag 192 | ID_OCTANE_ENVIRONMENT_TAG = 1029643 193 | ID_OCTANE_OBJECTTAG = 1029603 194 | ID_OCTANE_LIGHT_TAG = 1029526 195 | 196 | ID_VOLUMEOBJECT = 1035792 197 | ID_SCATTER_OBJECT = 1035961 198 | ID_OCTANE_DAYLIGHT_TAG = 1029754 199 | 200 | AOV_SYMBOLS: dict[int, str] = { 201 | RNDAOV_AO: 'Ao', 202 | RNDAOV_AOALPHASHD: 'Ao alpha shadow', 203 | RNDAOV_AODIST: 'Aodist', 204 | RNDAOV_BAKEGROUP_ID: 'Bakegroup Id', 205 | RNDAOV_BEAUTY_DENOISER: 'Beauty Denoiser', 206 | RNDAOV_CRYPTOMATTE: 'Cryptomatte', 207 | RNDAOV_CUSTOM: 'Custom', 208 | RNDAOV_CUSTOM_IDS: 'Custom Ids', 209 | RNDAOV_DENOISER_DIFFUSE_D: 'Denoiser diffuse direct', 210 | RNDAOV_DENOISER_DIFFUSE_I: 'Denoiser Diffuse indirect', 211 | RNDAOV_DENOISER_EMISSION: 'Denoiser Emission', 212 | RNDAOV_DENOISER_REFLECT_D: 'Denoiser Reflect direct', 213 | RNDAOV_DENOISER_REFLECT_I: 'Denoiser Reflect indirect', 214 | RNDAOV_DENOISER_REFRACTION: 'Denoiser Refraction', 215 | RNDAOV_DENOISER_REMAINDER: 'Denoiser Remainder', 216 | RNDAOV_DENOISER_VOLUME: 'Denoiser Volume', 217 | RNDAOV_DENOISER_VOL_EMIS: 'Denoiser Vol Emission', 218 | RNDAOV_DIFFUSE: 'Diffuse', 219 | RNDAOV_DIF_D: 'Diffuse direct', 220 | RNDAOV_DIF_FILTER: 'Diffuse Filter', 221 | RNDAOV_DIF_I: 'Diffuse indirect', 222 | RNDAOV_DISTR_PT: 'Distr Pt', 223 | RNDAOV_DIST_TRACING: 'Dist Tracing', 224 | RNDAOV_EMIT: 'Emit', 225 | RNDAOV_ENV: 'Env', 226 | RNDAOV_FSIZE: 'Fsize', 227 | RNDAOV_GEONORM: 'Geo normal', 228 | RNDAOV_GEONORM_N: 'Geonorm N', 229 | RNDAOV_GLOBALTEX: 'Globaltex', 230 | RNDAOV_INFO_DIFFUSE: 'Info Diffuse', 231 | RNDAOV_INFO_IOR: 'Info Ior', 232 | RNDAOV_INFO_OPACITY: 'Info Opacity', 233 | RNDAOV_INFO_REFLECTION: 'Info Reflection', 234 | RNDAOV_INFO_REFL_FILTER: 'Info Refl Filter', 235 | RNDAOV_INFO_REFRACTION: 'Info Refraction', 236 | RNDAOV_INFO_REFRACT_FILTER: 'Info Refract Filter', 237 | RNDAOV_INFO_ROUGHNESS: 'Info Roughness', 238 | RNDAOV_INFO_TRANSMISSON: 'Info Transmisson', 239 | RNDAOV_IRRADIANCE: 'Irradiance', 240 | RNDAOV_LAYER_BLACKSHD: 'Layer Blackshd', 241 | RNDAOV_LAYER_COLORSHD: 'Layer Colorshd', 242 | RNDAOV_LAYER_REFLECTION: 'Layer Reflection', 243 | RNDAOV_LIGHT: 'Light', 244 | RNDAOV_LIGHT_D: 'Light direct', 245 | RNDAOV_LIGHT_DIRECTION: 'Light Direction', 246 | RNDAOV_LIGHT_I: 'Light indirect', 247 | RNDAOV_LIGHT_PASS_ID: 'Light Pass Id', 248 | RNDAOV_MATID: 'Material id', 249 | RNDAOV_MAXSPEED: 'Maxspeed', 250 | RNDAOV_MOTION_VECTOR: 'Motion Vector', 251 | RNDAOV_MOT_VECTOR_N: 'Mot Vector N', 252 | RNDAOV_NOISE: 'Noise', 253 | RNDAOV_OBJECT_ID: 'Object Id', 254 | RNDAOV_OBJECT_LAYER_COLOR: 'Object Layer Color', 255 | RNDAOV_POSITION: 'Position', 256 | RNDAOV_POSITION_N: 'Position N', 257 | RNDAOV_POST: 'Post', 258 | RNDAOV_POST_INCLUDE_ENV: 'Post Include Env', 259 | RNDAOV_RAW: 'Raw', 260 | RNDAOV_REFLECTION: 'Reflection', 261 | RNDAOV_REFL_D: 'Refl direct', 262 | RNDAOV_REFL_FILTER: 'Refl Filter', 263 | RNDAOV_REFL_I: 'Refl indirect', 264 | RNDAOV_REFRACT: 'Refract', 265 | RNDAOV_REFRACT_FILTER: 'Refract Filter', 266 | RNDAOV_RENDER_LAYER_ID: 'Render Layer Id', 267 | RNDAOV_RENDER_LAYER_MASK: 'Render Layer Mask', 268 | RNDAOV_SHADOW: 'Shadow', 269 | RNDAOV_SHDNORM: 'Shdnorm', 270 | RNDAOV_SHDNORM_N: 'Shdnorm N', 271 | RNDAOV_SMOOTHNORM: 'Smoothnorm', 272 | RNDAOV_SMOOTHNORM_N: 'Smoothnorm N', 273 | RNDAOV_SSS: 'SSS', 274 | RNDAOV_TANGENT: 'Tangent', 275 | RNDAOV_TANGENT_N: 'Tangent N', 276 | RNDAOV_TEX_TANGENT: 'Tex Tangent', 277 | RNDAOV_TEX_TANGENT_N: 'Tex Tangent N', 278 | RNDAOV_TRANS: 'Trans', 279 | RNDAOV_TRANSM_FILTER: 'Transm Filter', 280 | RNDAOV_UVMAX: 'Uvmax', 281 | RNDAOV_UVSET: 'Uvset', 282 | RNDAOV_UV_COORD: 'Uv Coord', 283 | RNDAOV_UV_COORD_N: 'Uv Coord N', 284 | RNDAOV_VISIBLE_AFTER: 'Visible After', 285 | RNDAOV_VOLUME: 'Volume', 286 | RNDAOV_VOLUME_EMISSION: 'Volume Emission', 287 | RNDAOV_VOLUME_MASK: 'Volume Mask', 288 | RNDAOV_VOLUME_Z_DEPTH_BACK: 'Volume Z Depth Back', 289 | RNDAOV_VOLUME_Z_DEPTH_FRONT: 'Volume Z Depth Front', 290 | RNDAOV_WIRE: 'Wire', 291 | RNDAOV_WIRE_BMPNRML_MAP: 'Wire Bmpnrml Map', 292 | RNDAOV_WIRE_HGLTBACK: 'Wire Hgltback', 293 | RNDAOV_WIRE_SHADING: 'Wire Shading', 294 | RNDAOV_ZDEPTH: 'Zdepth', 295 | RNDAOV_ZDEPTH_ENVDEPTH: 'Zdepth Envdepth', 296 | RNDAOV_ZDEPTH_MAX: 'Zdepth Max', 297 | RNDAOV_ZDEPTH_N: 'Zdepth Normal' 298 | } 299 | 300 | CAMERA_TYPE = 1439 301 | CAM_TYPE_UNIVERSIAL = 5 302 | CAM_UNIVERSIAL_APERTURESHAPE = 1515 303 | CAM_APERTURE_CUSTOM = 4 304 | CAM_APERTURE_TEXTURE = 1507 305 | 306 | MAT_NAME_SYMBOLS: dict[int, str] = { 307 | ID_OCTANE_STANDARD_SURFACE: "Standard Surface", 308 | ID_OCTANE_COMPOSITE_MATERIAL: "Composite Material", 309 | MAT_TYPE_SPECULAR: "Specular", 310 | MAT_TYPE_DIFFUSE: "Diffuse", 311 | MAT_TYPE_GLOSSY: "Glossy", 312 | MAT_TYPE_METALLIC: "Metalc", 313 | MAT_TYPE_UNIVERSAL: "Universal", 314 | MAT_TYPE_TOON: "Toon" 315 | 316 | } 317 | 318 | ID_ORBX_LOADER: int = 1050418 -------------------------------------------------------------------------------- /constants/redshift_id.py: -------------------------------------------------------------------------------- 1 | import c4d 2 | 3 | ### ========== Redshift ID ========== ### 4 | # Redshift ID 5 | ID_REDSHIFT_VIDEO_POST = 1036219 6 | 7 | REDSHIFT_AOV_TYPE_WORLD_POSITION = 0 8 | REDSHIFT_AOV_TYPE_DEPTH = 1 9 | REDSHIFT_AOV_TYPE_PUZZLE_MATTE = 2 10 | REDSHIFT_AOV_TYPE_MOTION_VECTORS = 3 11 | REDSHIFT_AOV_TYPE_OBJECT_ID = 4 12 | REDSHIFT_AOV_TYPE_DIFFUSE_LIGHTING = 5 13 | REDSHIFT_AOV_TYPE_DIFFUSE_LIGHTING_RAW = 6 14 | REDSHIFT_AOV_TYPE_DIFFUSE_FILTER = 7 15 | REDSHIFT_AOV_TYPE_SPECULAR_LIGHTING = 8 16 | REDSHIFT_AOV_TYPE_SUB_SURFACE_SCATTER = 9 17 | REDSHIFT_AOV_TYPE_SUB_SURFACE_SCATTER_RAW = 10 18 | REDSHIFT_AOV_TYPE_REFLECTIONS = 11 19 | REDSHIFT_AOV_TYPE_REFLECTIONS_RAW = 12 20 | REDSHIFT_AOV_TYPE_REFLECTIONS_FILTER = 13 21 | REDSHIFT_AOV_TYPE_REFRACTIONS = 14 22 | REDSHIFT_AOV_TYPE_REFRACTIONS_RAW = 15 23 | REDSHIFT_AOV_TYPE_REFRACTIONS_FILTER = 16 24 | REDSHIFT_AOV_TYPE_EMISSION = 17 25 | REDSHIFT_AOV_TYPE_GLOBAL_ILLUMINATION = 18 26 | REDSHIFT_AOV_TYPE_GLOBAL_ILLUMINATION_RAW = 19 27 | REDSHIFT_AOV_TYPE_CAUSTICS = 20 28 | REDSHIFT_AOV_TYPE_CAUSTICS_RAW = 21 29 | REDSHIFT_AOV_TYPE_AMBIENT_OCCLUSION = 22 30 | REDSHIFT_AOV_TYPE_SHADOWS = 23 31 | REDSHIFT_AOV_TYPE_NORMALS = 24 32 | REDSHIFT_AOV_TYPE_BUMP_NORMALS = 25 33 | REDSHIFT_AOV_TYPE_MATTE = 26 34 | REDSHIFT_AOV_TYPE_VOLUME_LIGHTING = 27 35 | REDSHIFT_AOV_TYPE_VOLUME_FOG_TINT = 28 36 | REDSHIFT_AOV_TYPE_VOLUME_FOG_EMISSION = 29 37 | REDSHIFT_AOV_TYPE_TRANSLUCENCY_LIGHTING_RAW = 30 38 | REDSHIFT_AOV_TYPE_TRANSLUCENCY_FILTER = 31 39 | REDSHIFT_AOV_TYPE_TRANSLUCENCY_GI_RAW = 32 40 | REDSHIFT_AOV_TYPE_TOTAL_DIFFUSE_LIGHTING_RAW = 33 41 | REDSHIFT_AOV_TYPE_TOTAL_TRANSLUCENCY_LIGHTING_RAW = 34 42 | REDSHIFT_AOV_TYPE_OBJECT_SPACE_POSITIONS = 35 43 | REDSHIFT_AOV_TYPE_OBJECT_SPACE_BUMP_NORMALS = 36 44 | REDSHIFT_AOV_TYPE_BACKGROUND = 37 45 | REDSHIFT_AOV_TYPE_MAIN = 38 46 | REDSHIFT_AOV_TYPE_CUSTOM = 39 47 | REDSHIFT_AOV_TYPE_IDS_AND_COVERAGE = 40 48 | REDSHIFT_AOV_TYPE_BEAUTY = 41 49 | REDSHIFT_AOV_TYPE_CRYPTOMATTE = 42 50 | REDSHIFT_AOV_TYPE_MAX = 43 51 | REDSHIFT_AOV_TYPE_NONE = 65535 52 | 53 | REDSHIFT_AOV_LIGHTGROUP_GLOBALAOV = 1024 54 | REDSHIFT_AOV_LIGHTGROUP_ALL = 1025 55 | REDSHIFT_AOV_LIGHTGROUP_NAMES = 1026 56 | 57 | REDSHIFT_AOV_PUZZLE_MATTE_MODE_MATERIAL_ID = 0 58 | REDSHIFT_AOV_PUZZLE_MATTE_MODE_OBJECT_ID = 1 59 | 60 | 61 | REDSHIFT_AOVS = [ 62 | REDSHIFT_AOV_TYPE_WORLD_POSITION, 63 | REDSHIFT_AOV_TYPE_DEPTH, 64 | REDSHIFT_AOV_TYPE_PUZZLE_MATTE, 65 | REDSHIFT_AOV_TYPE_MOTION_VECTORS, 66 | REDSHIFT_AOV_TYPE_OBJECT_ID, 67 | REDSHIFT_AOV_TYPE_DIFFUSE_LIGHTING, 68 | REDSHIFT_AOV_TYPE_DIFFUSE_LIGHTING_RAW, 69 | REDSHIFT_AOV_TYPE_DIFFUSE_FILTER, 70 | REDSHIFT_AOV_TYPE_SPECULAR_LIGHTING, 71 | REDSHIFT_AOV_TYPE_SUB_SURFACE_SCATTER, 72 | REDSHIFT_AOV_TYPE_SUB_SURFACE_SCATTER_RAW, 73 | REDSHIFT_AOV_TYPE_REFLECTIONS, 74 | REDSHIFT_AOV_TYPE_REFLECTIONS_RAW, 75 | REDSHIFT_AOV_TYPE_REFLECTIONS_FILTER, 76 | REDSHIFT_AOV_TYPE_REFRACTIONS, 77 | REDSHIFT_AOV_TYPE_REFRACTIONS_RAW, 78 | REDSHIFT_AOV_TYPE_REFRACTIONS_FILTER, 79 | REDSHIFT_AOV_TYPE_EMISSION, 80 | REDSHIFT_AOV_TYPE_GLOBAL_ILLUMINATION, 81 | REDSHIFT_AOV_TYPE_GLOBAL_ILLUMINATION_RAW, 82 | REDSHIFT_AOV_TYPE_CAUSTICS, 83 | REDSHIFT_AOV_TYPE_CAUSTICS_RAW, 84 | REDSHIFT_AOV_TYPE_AMBIENT_OCCLUSION, 85 | REDSHIFT_AOV_TYPE_SHADOWS, 86 | REDSHIFT_AOV_TYPE_NORMALS, 87 | REDSHIFT_AOV_TYPE_BUMP_NORMALS, 88 | REDSHIFT_AOV_TYPE_MATTE, 89 | REDSHIFT_AOV_TYPE_VOLUME_LIGHTING, 90 | REDSHIFT_AOV_TYPE_VOLUME_FOG_TINT, 91 | REDSHIFT_AOV_TYPE_VOLUME_FOG_EMISSION, 92 | REDSHIFT_AOV_TYPE_TRANSLUCENCY_LIGHTING_RAW, 93 | REDSHIFT_AOV_TYPE_TRANSLUCENCY_FILTER, 94 | REDSHIFT_AOV_TYPE_TRANSLUCENCY_GI_RAW, 95 | REDSHIFT_AOV_TYPE_TOTAL_DIFFUSE_LIGHTING_RAW, 96 | REDSHIFT_AOV_TYPE_TOTAL_TRANSLUCENCY_LIGHTING_RAW, 97 | REDSHIFT_AOV_TYPE_OBJECT_SPACE_POSITIONS, 98 | REDSHIFT_AOV_TYPE_OBJECT_SPACE_BUMP_NORMALS, 99 | REDSHIFT_AOV_TYPE_BACKGROUND, 100 | REDSHIFT_AOV_TYPE_MAIN, 101 | REDSHIFT_AOV_TYPE_CUSTOM, 102 | REDSHIFT_AOV_TYPE_IDS_AND_COVERAGE, 103 | REDSHIFT_AOV_TYPE_BEAUTY, 104 | REDSHIFT_AOV_TYPE_CRYPTOMATTE, 105 | REDSHIFT_AOV_TYPE_MAX, 106 | REDSHIFT_AOV_TYPE_NONE 107 | ] 108 | 109 | REDSHIFT_AOVS_NAME = [ 110 | 'World Position', 111 | 'Z', 112 | 'Puzzle Matte', 113 | 'Motion Vectors', 114 | 'Object Id', 115 | 'Diffuse Lighting', 116 | 'Diffuse Lighting Raw', 117 | 'Diffuse Filter', 118 | 'Specular Lighting', 119 | 'Sub Surface Scatter', 120 | 'Sub Surface Scatter Raw', 121 | 'Reflections', 122 | 'Reflections Raw', 123 | 'Reflections Filter', 124 | 'Refractions', 125 | 'Refractions Raw', 126 | 'Refractions Filter', 127 | 'Emission', 128 | 'Global Illumination', 129 | 'Global Illumination Raw', 130 | 'Caustics', 131 | 'Caustics Raw', 132 | 'Ambient Occlusion', 133 | 'Shadows', 134 | 'Normals', 135 | 'Bump Normals', 136 | 'Matte', 137 | 'Volume Lighting', 138 | 'Volume Fog Tint', 139 | 'Volume Fog Emission', 140 | 'Translucency Lighting Raw', 141 | 'Translucency Filter', 142 | 'Translucency Gi Raw', 143 | 'Total Diffuse Lighting Raw', 144 | 'Total Translucency Lighting Raw', 145 | 'Object Space Positions', 146 | 'Object Space Bump Normals', 147 | 'Background', 148 | 'Main', 149 | 'Custom', 150 | 'Ids And Coverage', 151 | 'Beauty', 152 | 'Cryptomatte', 153 | 'Max', 154 | 'None'] 155 | 156 | 157 | ID_PREFERENCES_NODE = 465001632 # Prefs ID 158 | ID_REDSHIFT = 1036219 # Redshift 159 | 160 | ID_REDSHIFT_LIGHT = 1036751 161 | ID_REDSHIFT_RSSKY = 1036754 162 | 163 | ID_REDSHIFT_TAG = 1036222 164 | ID_REDSHIFT_ENVIROMENT = 1036757 165 | ID_REDSHIFT_VOLUME = 1038655 166 | ID_REDSHIFT_BAKESET = 1040211 167 | 168 | ID_REDSHIFT_PROXY = 1038649 169 | 170 | REDSHIFT_PROXY_DISPLAY_MODE_OFF = 0 171 | REDSHIFT_PROXY_DISPLAY_MODE_BOUNDING_BOX = 1 172 | REDSHIFT_PROXY_DISPLAY_MODE_MESH = 2 173 | 174 | REDSHIFT_PROXY_MATERIAL_MODE_INTERNAL = 0 175 | REDSHIFT_PROXY_MATERIAL_MODE_SCENE_PLACEHOLDER = 1 176 | REDSHIFT_PROXY_MATERIAL_MODE_SCENE_NAME = 2 177 | 178 | REDSHIFT_CAMERA = 1057516 179 | 180 | REDSHIFT_BRDF_IDS = [ 181 | "com.redshift3d.redshift4c4d.nodes.core.standardmaterial", 182 | "com.redshift3d.redshift4c4d.nodes.core.material", 183 | "com.redshift3d.redshift4c4d.nodes.core.sprite", 184 | "com.redshift3d.redshift4c4d.nodes.core.materialblender", 185 | "com.redshift3d.redshift4c4d.nodes.core.materiallayer" 186 | ] -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | # Renderer 2 | > Older version called **renderEngine** had been move to versions folder, if you still interested. 3 | 4 | Wrapper class for the maxon and c4d API of popular render engine for Cinema 4D. 5 | 6 | Intended for more user-friendly manipulation of node materials with the new maxon.GraphNode model.And also with Octane Node Material model. 7 | 8 | Provide helper class for convenient access AOV , Material , Scene Object(Object/Tag/Light/...) in Cinema 4D popular renderer. 9 | 10 | Happy Rendering and Scpriting! 11 | 12 | ## Supported Renderer 13 | - Octane 14 | - Node Materials with the new GraphNode model 15 | - Redshift ( Only Node Material for Material Helper) 16 | - Arnold ( Only Node Material for Material Helper) 17 | - Vray ( Only Node Material for Material Helper) 18 | - CentiLeo ( Only Node Material for Material Helper) 19 | - Corona 20 | - Waiting for more... 21 | 22 | ## About Boghma 23 | 24 | Boghma is a open community for c4d developers, we are trying to make it easier for everyone to create plugins and share them. 25 | 26 | This library is also included in [Boghma](https://www.boghma.com/) python library. 27 | 28 | You can install our free plugin [Boghma Plugin Manager](https://www.boghma.com/c4d/plugins-manager) and install any plugin you want, this library will be automatically installed or updated. 29 | 30 | If you want to share your free plugins or libaray, please join us in [Join Us](https://flowus.cn/boghma/share/96035b74-6205-4e6c-b49c-65de7d1e2e62). 31 | 32 | ``` 33 | All the boghma plugins and boghma library are personal FREE. 34 | ``` 35 | 36 | ## Installation 37 | 38 | 1. (**Recommend**) Download [Boghma Plugin Manager](https://www.boghma.com/c4d/plugins-manager) and install any plugin, the boghma lib will auto installed or updated. 39 | 2. Download the source code and import it to your Cinema 4D. 40 | 41 | # Limit 42 | - For some reasons, AddShader-like methods(maxon.GraphModelInterface.AddChild) will add the node in the center of the graph, if we call those methods on exsited material, it will return a mess graph, you can call Renderer.ArrangeAll() after. 43 | - Material(except Octane) helper only support material with the new GraphNode model(Node Material after R26) 44 | - Due to Octane use his Custom UserArea UI base on old layer system, and didn't support python, we can only modify Octane materials in material level, but can not interactive with selections in octane node editor. 45 | - Also Octane materials didn't have a "port" or "wire" context, we can not use all those methods as same as NodeGraghHelper. 46 | - Arnold mask tag SetPrameter has a refresh bug. 47 | 48 | 49 | # Quick Intro 50 | 51 | ```python 52 | 53 | import c4d 54 | import maxon 55 | from Renderer import Redshift, EasyTransaction, TextureHelper 56 | from pprint import pprint 57 | 58 | # Create a TextureHelper instance 59 | # 创建一个 TextureHelper 实例 60 | tex_helper: TextureHelper = TextureHelper() 61 | 62 | # Get the url with given asset id 63 | # 获取给定资产ID的URL 64 | # "si-v1_fingerprints_02_15cm.png" with AssetId : file_fa9c42774dd05049 65 | disp: maxon.Url = tex_helper.GetAssetUrl("file_fa9c42774dd05049") 66 | 67 | def HowToUse(): 68 | """ 69 | How to reate a redshift material and modify the gragh with EasyTransaction. 70 | """ 71 | 72 | # Create Redshift Node Material instance, if no material filled, we create a new STD material 73 | # 创建一个Redshift节点材质实例,如果没有材质传入,创建新的STD材质 74 | material: c4d.BaseMaterial = Redshift.Material("MyMaterial") 75 | 76 | # Use EasyTransaction to modify the graph 77 | # 使用EasyTransaction来修改材质 78 | with EasyTransaction(material) as tr: 79 | 80 | # the attribute #tr is the instance of Redshift.MaterialHelper, 81 | # we got it with just apply to the #material to the EasyTransaction 82 | # it will inherit from NodeGraghHelper class 83 | # 属性tr是Redshift.MaterialHelper的实例,通过将材质赋予EasyTransaction获得,继承自NodeGraghHelper 84 | 85 | # Use Redshift.MaterialHelper methods : add a texture + displacement to the Output node 86 | # 使用Redshift.MaterialHelper中的方法: 添加图片+置换节点到Output节点 87 | tr.AddDisplacementTree(filepath = disp, shadername = "DISP") 88 | 89 | # Use NodeGraghHelper methods: get the Output(endNode) 90 | # 使用NodeGraghHelper中的方法: 获取输出节点 91 | output = tr.GetOutput() 92 | print(f"{output = }") 93 | 94 | # Insert the material to the document 95 | # 导入材质(来自Redshift MaterialHelper) 96 | tr.InsertMaterial() 97 | 98 | # Auto apply GraphTransaction.Commit() to the graph 99 | # 退出with后, 自动执行GraphTransaction.Commit() 100 | 101 | ``` 102 | 103 | # Examples 104 | - [__Material Example__](./tests/01_material_basic.py) 105 | - [__AOV Example__](./tests/02_aov_basic.py) 106 | - [__Scene Example__](./tests/03_scene_basic.py) 107 | 108 | 109 | # Class Presentation 110 | 111 | Renderer 112 | - NodeGraghHelper 113 | - TextureHelper 114 | - EasyTransaction 115 | - ConverterPorts 116 | - Redshift 117 | - AOV 118 | - Material 119 | - Scene 120 | - Octane 121 | - AOV 122 | - Material 123 | - Scene 124 | - Arnold 125 | - AOV 126 | - Material 127 | - Scene 128 | - Corona 129 | - AOV 130 | - Material 131 | - Vray 132 | - AOV 133 | - Material 134 | - CentiLeo 135 | - AOV 136 | - Material 137 | - utils 138 | - NodeGraghHelper 139 | - TextureHelper 140 | - EasyTransaction 141 | - MaterialMaker 142 | - constants 143 | - ... 144 | -------------------------------------------------------------------------------- /tests/01_material_basic.py: -------------------------------------------------------------------------------- 1 | import c4d 2 | import maxon 3 | import Renderer 4 | from Renderer import Redshift, Arnold, Octane, Vray, CentiLeo, EasyTransaction, TextureHelper 5 | from pprint import pprint 6 | 7 | """ 8 | These examples show how to create and modify materials 9 | We can use Renderer.NodeGraghHelper to modify node materials who used new node graph, 10 | And we can use Redshift.Material and Arnold.Material to get some preset helper methods. 11 | 12 | For some reasons, AddShader-like methods(maxon.GraphModelInterface.AddChild) will add the node in the center 13 | If we call those methods on exsited material, it will be a mess, you can call Renderer.ArrangeAll() after. 14 | 15 | Due to Octane use his Custom UserArea UI base on old layer system, and didn't support python 16 | We can only modify in material level, but can not interactive with selections in octane node editor. 17 | 18 | 19 | """ 20 | 21 | # Create a TextureHelper instance 22 | # 创建一个 TextureHelper 实例 23 | tex_helper: TextureHelper = TextureHelper() 24 | 25 | # 获取资产路径, "UV Test Grid.png" with AssetId : file_5b6a5fe03176444c 26 | url: maxon.Url = tex_helper.GetAssetUrl("file_5b6a5fe03176444c") 27 | 28 | # "si-v1_fingerprints_02_15cm.png" with AssetId : file_fa9c42774dd05049 29 | disp: maxon.Url = tex_helper.GetAssetUrl("file_fa9c42774dd05049") 30 | 31 | # How to reate a redshift material and modify 32 | def create_material(): 33 | 34 | """ 35 | How to reate a redshift material and modify the gragh with EasyTransaction. 36 | """ 37 | 38 | # Create Redshift Node Material instance, if no material filled, we create a new STD material. 39 | # 创建一个Redshift节点材质实例,如果没有材质传入,创建新的STD材质 40 | material: c4d.BaseMaterial = Redshift.Material("MyMaterial") 41 | 42 | # Use EasyTransaction to modify the graph 43 | # 使用EasyTransaction来修改材质 44 | with EasyTransaction(material) as tr: 45 | 46 | # the attribute #tr is the instance of Redshift.MaterialHelper, 47 | # we got it with just apply to the #material to the EasyTransaction 48 | # it will inherit from NodeGraghHelper class 49 | # 属性tr是Redshift.MaterialHelper的实例,通过将材质赋予EasyTransaction获得,继承自NodeGraghHelper 50 | 51 | # Use Redshift.MaterialHelper methods : add a texture + displacement to the Output node 52 | # 使用Redshift.MaterialHelper中的方法: 添加图片+置换节点到Output节点 53 | tr.AddDisplacementTree(filepath = disp, shadername = "DISP") 54 | 55 | # Use NodeGraghHelper methods: get the Output(endNode) 56 | # 使用NodeGraghHelper中的方法: 获取输出节点 57 | output = tr.GetOutput() 58 | print(f"{output = }") 59 | 60 | # Insert the material to the document 61 | # 导入材质(来自Redshift MaterialHelper) 62 | tr.InsertMaterial() 63 | 64 | # Auto apply GraphTransaction.Commit() to the graph 65 | # 退出with后, 自动执行GraphTransaction.Commit() 66 | 67 | # Modify an exist material 68 | # select the material we just create to call this example 69 | def modify_material(): 70 | 71 | # 选择material 72 | material: c4d.BaseMaterial = c4d.documents.GetActiveDocument().GetActiveMaterial() 73 | 74 | # 自定义EasyTransaction 75 | # 将材质转换为支持的MaterialHelper实例 76 | with EasyTransaction(material) as tr: 77 | 78 | # 使用NodeGraghHelper中的方法 79 | output = tr.GetOutput() 80 | # 使用NodeGraghHelper中的SetName方法,更改节点名称 81 | tr.SetName(output, "My Output Node") 82 | 83 | # Find brdf node (in this case : standard surface) 84 | # 查找Standard Surface节点 85 | standard_surface = tr.GetRootBRDF() 86 | 87 | # Change a shader name 88 | # 更改Standard Surface节点名称 89 | tr.SetName(standard_surface,'My BRDF Shader') 90 | 91 | # 获取Standard Surface上的base color端口 92 | tar = tr.GetPort(standard_surface,'com.redshift3d.redshift4c4d.nodes.core.standardmaterial.base_color') 93 | 94 | # 将纹理节点树(triplaner)到 base color 节点中 95 | tr.AddTextureTree(shadername = 'Asset UV Map', filepath = url, raw = True, triplaner_node = True, scaleramp = False, target_port = tar) 96 | 97 | # 添加置换树 98 | tr.AddDisplacementTree() 99 | 100 | # 清理未连接的节点,如果没有指认filterId,则清理全部未连接 101 | tr.RemoveIsolateNodes() 102 | 103 | # 退出with后, 自动执行Commit() 104 | 105 | # Modify an exist material with selections 106 | def access_material_data(): 107 | 108 | # 选择material 109 | material: c4d.BaseMaterial = c4d.documents.GetActiveDocument().GetActiveMaterial() 110 | 111 | # 自定义EasyTransaction 112 | # 将材质转换为支持的MaterialHelper实例 113 | with EasyTransaction(material) as tr: 114 | 115 | # 获取选择的节点,当single_mode为True时,如果只有一个节点被选中,则返回节点(而不是列表) 116 | act_node: maxon.GraphNode = tr.GetActiveNodes(single_mode=True) 117 | act_port: maxon.GraphNode = tr.GetActivePorts(single_mode=True) 118 | act_wire: list[maxon.GraphNode, maxon.GraphNode, maxon.Wires] = tr.GetActiveWires(single_mode=True) 119 | 120 | # when we select a true node in redshift node space 121 | # if the selected node is a image node, add a unitransform group to it 122 | if act_node: 123 | # Redshift空间 124 | if tr.nodespaceId == Renderer.RS_NODESPACE: 125 | # 如果选择的节点是纹理节点 126 | if tr.GetShaderId(act_node) == "texturesampler": 127 | 128 | # Set the preview image "OFF" 129 | tr.FoldPreview(act_node, False) 130 | 131 | # 创建一个UniTranform自定义组,统一控制纹理节点的PSR 132 | tr.AddUniTransform(tex_shader=act_node) 133 | 134 | # when we select a port with data type "color" 135 | # we add a node tree to this port. 136 | if act_port: 137 | # 颜色 / 浮点端口 138 | if tr.GetPortDataTypeId(act_port) == maxon.Id("net.maxon.parametrictype.col<3,float64>"): 139 | tr.AddTexture(filepath=url, shadername="Color Texture", raw=False, target_port=act_port) 140 | 141 | # when we select a wire, 142 | # we insert a cc node into the wire. 143 | if act_wire: 144 | tr.InsertShader("com.redshift3d.redshift4c4d.nodes.core.rscolorcorrection", 145 | act_wire, 146 | ['com.redshift3d.redshift4c4d.nodes.core.rscolorcorrection.input'], 147 | 'com.redshift3d.redshift4c4d.nodes.core.rscolorcorrection.outcolor') 148 | 149 | # Get all connected ports. 150 | connect_ports: list = tr.GetAllConnectedPorts() 151 | print("All Connected Ports:") 152 | for port in connect_ports: 153 | print(tr.GetName(port)) 154 | print("="*10) 155 | 156 | # 退出with后, 自动执行Commit() 157 | 158 | # Modify an exist Octane material 159 | def modify_octane_material(): 160 | 161 | # 如果不传入material,则初始化一个Octane material(Standard/Universal) 162 | material: Octane.Material = Renderer.Octane.Material(create_standard=False) 163 | 164 | # Add a float texture to roughness port 165 | material.AddFloat(parentNode = c4d.OCT_MATERIAL_ROUGHNESS_LINK) 166 | 167 | # Add a node tree to Albedo port, and set path and props 168 | url: maxon.Url = tex_helper.GetAssetStr("file_ed38c13fd1ae85ae") 169 | material.AddTextureTree(texturePath = url, nodeName = 'Albedo', isFloat = False, gamma = 2.2, 170 | invert = False, parentNode = c4d.OCT_MATERIAL_DIFFUSE_LINK) 171 | 172 | # Get all shader in the material 173 | node_list = material.GetAllShaders() 174 | 175 | # Get all the image nodes, we just have one, so we get it 176 | imageNode = material.GetNodes(Octane.ID_OCTANE_IMAGE_TEXTURE)[0] 177 | nodesAfter = material.GetNextNodes(imageNode) 178 | 179 | # Print the info 180 | print(f'We create an Octane Material with name {material.material.GetName()}') 181 | print('#-----Shader-----#') 182 | pprint(node_list) 183 | print('#-----Image-----#') 184 | pprint(imageNode) 185 | print('#-----Shader Tree-----#') 186 | pprint(nodesAfter) 187 | print('#----- End -----#') 188 | 189 | # Insert the material to the doc, activ doc is defult when None passed. 190 | material.InsertMaterial() 191 | 192 | # Update the material 193 | material.Refresh() 194 | 195 | # Push a Refresh to Cinema 196 | c4d.EventAdd() 197 | 198 | # Open Octane Node Editor with the material 199 | Octane.OpenNodeEditor(material) 200 | 201 | def ConvertTest(): 202 | 203 | material: c4d.BaseMaterial = c4d.documents.GetActiveDocument().GetActiveMaterial() 204 | 205 | with EasyTransaction(material) as tr: 206 | 207 | nodes = tr.GetActiveNodes() 208 | for node in nodes: 209 | print(f"Node: {tr.GetName(node)}") 210 | print(f"Default Input: {tr.GetConvertInput(node)}") 211 | print(f"Default Output: {tr.GetConvertOutput(node)}") 212 | print("-"*10) 213 | 214 | 215 | import c4d 216 | import maxon 217 | import Renderer 218 | from Renderer import Redshift,EasyTransaction 219 | from pprint import pprint 220 | 221 | def test(): 222 | 223 | material: c4d.BaseMaterial = Redshift.Material("MyMaterial") 224 | 225 | # Use EasyTransaction to modify the graph 226 | # 使用EasyTransaction来修改材质 227 | with EasyTransaction(material) as tr: 228 | 229 | std = tr.GetRootBRDF() 230 | base_color = tr.GetPort(std, "com.redshift3d.redshift4c4d.nodes.core.standardmaterial.base color") 231 | refl_color = tr.GetPort(std, "com.redshift3d.redshift4c4d.nodes.core.standardmaterial.refl color") 232 | ior = tr.AddConnectShader( 233 | "com.redshift3d.redshift4c4d.nodes.core.iortometaltints", 234 | output_ports=["com.redshift3d.redshift4c4d.nodes.core.iortometaltints.facing", "com.redshift3d.redshift4c4d.nodes.core.iortometaltints.edgetint"], 235 | connect_outNodes=[base_color,refl_color] 236 | ) 237 | 238 | # Insert the material to the document 239 | # 导入材质(来自Redshift MaterialHelper) 240 | tr.InsertMaterial() 241 | 242 | 243 | if __name__ == '__main__': 244 | Renderer.ClearConsole() 245 | create_material() 246 | # modify_material() 247 | # access_material_data() 248 | # modify_octane_material() 249 | # ConvertTest() 250 | c4d.EventAdd() -------------------------------------------------------------------------------- /tests/02_aov_basic.py: -------------------------------------------------------------------------------- 1 | import c4d 2 | import maxon 3 | import Renderer 4 | from Renderer import Redshift, Arnold, Octane, Vray, Corona 5 | from pprint import pprint 6 | 7 | 8 | # How to create and modify redshift aovs 9 | def modify_redshift_aov(): 10 | 11 | # Get the videopost host the aovs 12 | doc: c4d.documents.BaseDocument = c4d.documents.GetActiveDocument() 13 | vp: c4d.documents.BaseVideoPost = Renderer.GetVideoPost(doc, Renderer.ID_REDSHIFT) 14 | # Set redshift AOVHelper instance 15 | aov_helper = Redshift.AOV(vp) 16 | 17 | # Create a redshift aov item 18 | # the id can find from Renderer.constants.redshift,or Redshift.theid 19 | # If #name is None, defulat to type name of the aov. 20 | diff_aov = aov_helper.create_aov_shader(aov_type = Redshift.REDSHIFT_AOV_TYPE_BEAUTY) 21 | # Add the DIFFUSE aov just created to the redshift aov system 22 | aov_helper.add_aov(diff_aov) 23 | 24 | # Add some aovs 25 | aov_helper.add_aov(aov_helper.create_aov_shader(aov_type = Redshift.REDSHIFT_AOV_TYPE_SHADOWS, aov_name = 'My Shadow')) 26 | aov_helper.add_aov(aov_helper.create_aov_shader(Redshift.REDSHIFT_AOV_TYPE_NORMALS)) 27 | aov_helper.add_aov(aov_helper.create_aov_shader(Redshift.REDSHIFT_AOV_TYPE_REFLECTIONS)) 28 | aov_helper.add_aov(aov_helper.create_aov_shader(Redshift.REDSHIFT_AOV_TYPE_REFRACTIONS)) 29 | aov_helper.add_aov(aov_helper.create_aov_shader(Redshift.REDSHIFT_AOV_TYPE_DEPTH)) 30 | aov_helper.add_aov(aov_helper.create_aov_shader(Redshift.REDSHIFT_AOV_TYPE_EMISSION)) 31 | aov_helper.add_aov(aov_helper.create_aov_shader(Redshift.REDSHIFT_AOV_TYPE_CRYPTOMATTE)) 32 | last_aov = aov_helper.add_aov(aov_helper.create_aov_shader(Redshift.REDSHIFT_AOV_TYPE_OBJECT_ID)) 33 | last_aov_name = aov_helper.get_name(last_aov) 34 | 35 | # Remove last aov: object id 36 | aov_helper.remove_last_aov() 37 | print(f'We remove the last AOV named: {last_aov_name}') 38 | 39 | # Remove specified aov: emission 40 | aov_helper.remove_aov_type(aov_type = Redshift.REDSHIFT_AOV_TYPE_EMISSION) 41 | print(f'We remove the AOV type: EMISSION @{Redshift.REDSHIFT_AOV_TYPE_EMISSION}') 42 | 43 | # update the depth aov "Use Camera Near/Far" to Flase 44 | aov_helper.update_aov(aov_type=Redshift.REDSHIFT_AOV_TYPE_DEPTH, aov_id=c4d.REDSHIFT_AOV_DEPTH_USE_CAMERA_NEAR_FAR, aov_attrib=False) 45 | print(f'We update the Depth AOV with attribute "Use Camera Near/Far" to False') 46 | 47 | # Set the #REFRACTION aov #name 48 | aov_helper.set_name(Redshift.REDSHIFT_AOV_TYPE_REFRACTIONS, "new refraction name") 49 | 50 | # Get the #SHADOW aov and his #name 51 | shadow = aov_helper.get_aovs(Redshift.REDSHIFT_AOV_TYPE_SHADOWS) 52 | if shadow: 53 | print(f'We find a AOV with Named {aov_helper.get_name(shadow)}') 54 | 55 | # Set the #REFRACTION aov #light group 56 | aov_helper.set_light_group(Redshift.REDSHIFT_AOV_TYPE_REFRACTIONS, "new group") 57 | print(f'We add a light group the REFRACTION AOV Named: new group') 58 | 59 | # Add a puzzle matte with same id(r=g=b), aka a white mask with given id 60 | aov_helper.set_puzzle_matte(puzzle_id = 2 ,aov_name = "My Puzzle 2") 61 | print(f'We add a white puzzle matte with ID = 2 , Name = "My Puzzle 2"') 62 | 63 | # Print current aov info 64 | aov_helper.print_aov() 65 | 66 | Redshift.AovManager() 67 | 68 | # How to create and modify octane aovs 69 | def modify_octane_aov(): 70 | 71 | # Get the videopost host the aovs 72 | doc: c4d.documents.BaseDocument = c4d.documents.GetActiveDocument() 73 | vp: c4d.documents.BaseVideoPost = Renderer.GetVideoPost(doc, Renderer.ID_OCTANE) 74 | # Set Octane AOVHelper instance 75 | aov_helper = Octane.AOV(vp) 76 | 77 | # Create a Octane aov item 78 | # the id can find from Renderer.constants.octane, or Octane.theid 79 | # If #name is None, defulat to type. 80 | diff_aov = aov_helper.create_aov_shader(aov_type = Octane.RNDAOV_DIFFUSE) 81 | # Add the DIFFUSE aov just created to the Octane aov system 82 | aov_helper.add_aov(diff_aov) 83 | 84 | # Add some aovs 85 | aov_helper.add_aov(aov_helper.create_aov_shader(aov_type = Octane.RNDAOV_POST,aov_name = 'POST')) 86 | aov_helper.add_aov(aov_helper.create_aov_shader(Octane.RNDAOV_DIF_D)) 87 | aov_helper.add_aov(aov_helper.create_aov_shader(Octane.RNDAOV_DIF_I)) 88 | aov_helper.add_aov(aov_helper.create_aov_shader(Octane.RNDAOV_REFL_D)) 89 | aov_helper.add_aov(aov_helper.create_aov_shader(Octane.RNDAOV_REFL_I)) 90 | aov_helper.add_aov(aov_helper.create_aov_shader(Octane.RNDAOV_WIRE)) 91 | aov_helper.add_aov(aov_helper.create_aov_shader(Octane.RNDAOV_OBJECT_LAYER_COLOR)) 92 | aov_helper.add_aov(aov_helper.create_aov_shader(Octane.RNDAOV_VOLUME)) 93 | 94 | # Remove last aov: volume 95 | aov_helper.remove_last_aov() 96 | 97 | # Remove specified aov: wire 98 | aov_helper.remove_aov_type(aov_type = Octane.RNDAOV_WIRE) 99 | 100 | # Add 2 custom aovs with id 1 and 2 101 | aov_helper.add_custom_aov(customID = 1) 102 | aov_helper.add_custom_aov(customID = 2) 103 | 104 | # Get the custom aov with id 2 105 | custom2 = aov_helper.get_custom_aov(customID = 2) 106 | if custom2: 107 | print(f'We find a Custom AOV with id 2 Named{custom2.GetName()}') 108 | 109 | # Print current aov info 110 | aov_helper.print_aov() 111 | Octane.AovManager() 112 | 113 | # How to create and modify arnold aovs 114 | def modify_arnold_aov(): 115 | 116 | # Get the videopost host the aovs 117 | doc: c4d.documents.BaseDocument = c4d.documents.GetActiveDocument() 118 | vp: c4d.documents.BaseVideoPost = Renderer.GetVideoPost(doc, Renderer.ID_ARNOLD) 119 | # Set Arnold AOVHelper instance 120 | aov_helper = Arnold.AOV(vp) 121 | 122 | # Start record undo 123 | aov_helper.doc.StartUndo() 124 | 125 | # Create a arnold Driver item 126 | exr_driver: c4d.BaseObject = aov_helper.create_aov_driver(isDisplay=False, driver_type=Arnold.C4DAIN_DRIVER_EXR, denoise=True, sRGB=False) 127 | display_driver: c4d.BaseObject = aov_helper.create_aov_driver(isDisplay=True) 128 | 129 | # Create a arnold aov item(aov type must as same as the aov manager aov) 130 | # If #name is None, defulat to #beauty. 131 | diff_aov: c4d.BaseObject = aov_helper.create_aov_shader(aov_name='diffuse') 132 | # Add the DIFFUSE aov just created to the arnold aov system 133 | aov_helper.add_aov(driver=exr_driver,aov=diff_aov) 134 | 135 | # Add some aovs to exr_driver 136 | aov_helper.add_aov(exr_driver,aov_helper.create_aov_shader("N")) 137 | aov_helper.add_aov(exr_driver,aov_helper.create_aov_shader("Z")) 138 | aov_helper.add_aov(exr_driver,aov_helper.create_aov_shader("sheen")) 139 | aov_helper.add_aov(exr_driver,aov_helper.create_aov_shader("specular")) 140 | aov_helper.add_aov(exr_driver,aov_helper.create_aov_shader("transmission")) 141 | aov_helper.add_aov(exr_driver,aov_helper.create_aov_shader("emission")) 142 | aov_helper.add_aov(exr_driver,aov_helper.create_aov_shader("coat")) 143 | last_aov: c4d.BaseObject = aov_helper.add_aov(exr_driver,aov_helper.create_aov_shader("sss")) 144 | last_name: str = last_aov.GetName() 145 | 146 | # Add some aovs to display_driver 147 | aov_helper.add_aov(display_driver,aov_helper.create_aov_shader("N")) 148 | aov_helper.add_aov(display_driver,aov_helper.create_aov_shader("Z")) 149 | 150 | # Find driver 151 | print(f"We have an exr driver called{aov_helper.get_driver('EXR').GetName()}") 152 | print(f"We also have a dispaly driver called{aov_helper.get_dispaly_driver().GetName()}") 153 | 154 | # Set exr_driver render path 155 | aov_helper.set_driver_path(exr_driver,r"C:\Users\DunHou\Desktop\DelMe") 156 | 157 | # Get all aovs of exr_driver 158 | pprint(aov_helper.get_aovs(exr_driver)) 159 | 160 | # Remove last aov: sss 161 | aov_helper.remove_last_aov(exr_driver) 162 | print(f'We remove the last AOV named: {last_name}') 163 | 164 | # Remove specified aov: N of display_driver 165 | aov_helper.remove_aov_type(display_driver,'N') 166 | print('We remove the AOV type: N of the display_driver') 167 | 168 | # Get the #emission aov and his #name 169 | emission = aov_helper.get_aov(exr_driver,'emission') 170 | if emission: 171 | print(f'We find a AOV with Named {emission.GetName()}') 172 | 173 | # Print current aov info 174 | aov_helper.print_aov() 175 | 176 | Arnold.AovManager() 177 | # End record undo 178 | aov_helper.doc.EndUndo() 179 | 180 | # How to create and modify vray aovs 181 | def modify_vray_aov(): 182 | 183 | # Get the doc host the aovs, in this case th active doc vp 184 | doc: c4d.documents.BaseDocument = c4d.documents.GetActiveDocument() 185 | vp: c4d.documents.BaseVideoPost = Renderer.GetVideoPost(doc, Renderer.ID_VRAY) 186 | # Set Vray AOVHelper instance 187 | aov_helper = Vray.AOV(vp) 188 | # the id can find from Renderer.constants.vray, or Vray_id.py 189 | # If #name is None, defulat to type. 190 | diff_aov = aov_helper.create_aov_shader(aov_type = Vray.VRAY_AOV_DIFFUSE) 191 | # Add the DIFFUSE aov just created to the vray aov system 192 | aov_helper.add_aov(diff_aov) 193 | 194 | # Add some aovs 195 | aov_helper.add_aov(aov_helper.create_aov_shader(aov_type = Vray.VRAY_AOV_BACKGROUND, aov_name = 'BG')) 196 | aov_helper.add_aov(aov_helper.create_aov_shader(Vray.VRAY_AOV_SPECULAR)) 197 | aov_helper.add_aov(aov_helper.create_aov_shader(Vray.VRAY_AOV_REFLECTION)) 198 | aov_helper.add_aov(aov_helper.create_aov_shader(Vray.VRAY_AOV_SHADOW)) 199 | aov_helper.add_aov(aov_helper.create_aov_shader(Vray.VRAY_AOV_LIGHT_MIX)) 200 | 201 | # Remove last aov: volume 202 | aov_helper.remove_last_aov() 203 | 204 | # Remove specified aov: wire 205 | aov_helper.remove_aov_type(aov_type = Vray.VRAY_AOV_DIFFUSE[0]) 206 | 207 | # Print current aov info 208 | aov_helper.print_aov() 209 | 210 | Vray.AovManager() 211 | 212 | # How to create and modify corona aovs 213 | def modify_corona_aov(): 214 | 215 | # Get the doc host the aovs, in this case th active doc vp 216 | doc: c4d.documents.BaseDocument = c4d.documents.GetActiveDocument() 217 | vp: c4d.documents.BaseVideoPost = Renderer.GetVideoPost(doc, Renderer.ID_CORONA) 218 | # Set Corona AOVHelper instance 219 | aov_helper = Corona.AOV(vp) 220 | 221 | # turn on the mutipass 222 | aov_helper.enable_mutipass(True) 223 | 224 | # Add the DIFFUSE aov 225 | diff_aov = aov_helper.create_aov_shader(aov_type = Corona.CORONA_MULTIPASS_TYPE_ALBEDO) 226 | aov_helper.add_aov(diff_aov) 227 | 228 | # Add some aovs 229 | aov_helper.add_aov(aov_helper.create_aov_shader(aov_type = Corona.CORONA_MULTIPASS_TYPE_EMISSION, aov_name = 'emmision aov')) 230 | aov_helper.add_aov(aov_helper.create_aov_shader(Corona.CORONA_MULTIPASS_TYPE_REFLECT)) 231 | aov_helper.add_aov(aov_helper.create_aov_shader(Corona.CORONA_MULTIPASS_TYPE_REFRACT)) 232 | aov_helper.add_aov(aov_helper.create_aov_shader(Corona.CORONA_MULTIPASS_TYPE_TRANSLUCENCY)) 233 | aov_helper.add_aov(aov_helper.create_aov_shader(Corona.CORONA_MULTIPASS_TYPE_ZDEPTH)) 234 | 235 | # Remove last aov: volume 236 | aov_helper.remove_last_aov() 237 | 238 | # Remove specified aov: wire 239 | aov_helper.remove_aov_type(aov_type = Corona.CORONA_MULTIPASS_TYPE_TRANSLUCENCY) 240 | 241 | # Print current aov info 242 | aov_helper.print_aov() 243 | 244 | Corona.AovManager() 245 | 246 | 247 | if __name__ == '__main__': 248 | Renderer.ClearConsole() 249 | 250 | modify_redshift_aov() 251 | # modify_octane_aov() 252 | # modify_arnold_aov() 253 | # modify_vray_aov() 254 | # modify_aorona_aov() 255 | 256 | c4d.EventAdd() -------------------------------------------------------------------------------- /tests/03_scene_basic.py: -------------------------------------------------------------------------------- 1 | import c4d 2 | import maxon 3 | import Renderer 4 | from Renderer import Redshift, Arnold, Octane, TextureHelper 5 | from pprint import pprint 6 | 7 | # Create a TextureHelper instance 8 | tex_helper: TextureHelper = TextureHelper() 9 | 10 | # How to create and modify redshift scene 11 | def modify_redshift_scene(): 12 | 13 | # Get the doc host the scene, in this case th active doc 14 | doc: c4d.documents.BaseDocument = c4d.documents.GetActiveDocument() 15 | # Set Redshift SceneHelper instance 16 | scene_helper = Redshift.Scene(doc) 17 | 18 | ### == Light == ### 19 | # Add a rig of hdr and rgb backdrop 20 | hdr_url: str = tex_helper.GetAssetStr("file_d21cf4cfdec8c636") 21 | scene_helper.add_dome_rig(texture_path = hdr_url, rgb = c4d.Vector(0,0,0)) 22 | 23 | # Add a light object and and some modify tags 24 | gobo_url: maxon.Url = tex_helper.GetAssetStr("file_66b116a34a150e7e") 25 | mylight = scene_helper.add_light(light_name = 'My Light', texture_path = gobo_url, intensity=2, exposure=0) 26 | scene_helper.add_light_modifier(light = mylight, target = True, gsg_link = True, rand_color = True) 27 | # Add a IES light 28 | ies_url: str = tex_helper.GetAssetStr("file_6f300f2ba077da4a") 29 | ies = scene_helper.add_ies(light_name = 'My IES', texture_path = ies_url, intensity=1, exposure=0) 30 | 31 | ### == Tag == ### 32 | # Add a Cude object and an Redshift tag with maskID 2 33 | cube = c4d.BaseObject(c4d.Ocube) 34 | scene_helper.add_object_id(node=cube, maskID=2) 35 | doc.InsertObject(cube) 36 | 37 | ### == Object == ### 38 | # Add a scatter obejct with some children and count 12345 39 | generate_object = c4d.BaseObject(c4d.Oplane) 40 | doc.InsertObject(generate_object) 41 | scatter_A = c4d.BaseObject(c4d.Oplatonic) 42 | scatter_B = c4d.BaseObject(c4d.Ooiltank) 43 | doc.InsertObject(scatter_A) 44 | doc.InsertObject(scatter_B) 45 | scatters: list[c4d.BaseObject] = [scatter_A, scatter_B] 46 | scene_helper.add_scatter(generator_node=generate_object, scatter_nodes=scatters, count=12345) 47 | 48 | # Add a object and set auto proxy 49 | the_object = c4d.BaseObject(c4d.Oplane) 50 | doc.InsertObject(the_object) 51 | the_object.SetName("Original Object") 52 | scene_helper.auto_proxy(nodes=the_object,remove_objects=False) 53 | 54 | # How to create and modify octane scene 55 | def modify_octane_scene(): 56 | 57 | # Get the doc host the scene, in this case th active doc 58 | doc: c4d.documents.BaseDocument = c4d.documents.GetActiveDocument() 59 | # Set Octane SceneHelper instance 60 | scene_helper = Octane.Scene(doc) 61 | 62 | ### == Light == ### 63 | # Add a rig of hdr and rgb backdrop 64 | hdr_url: maxon.Url = tex_helper.GetAssetStr("file_d21cf4cfdec8c636") 65 | scene_helper.add_dome_rig(texture_path = hdr_url, rgb = c4d.Vector(0,0,0)) 66 | # Add a light object and and some modify tags 67 | gobo_url: maxon.Url = tex_helper.GetAssetStr("file_66b116a34a150e7e") 68 | mylight = scene_helper.add_light(power = 5, light_name = 'My Light', texture_path = gobo_url, distribution_path = None, visibility= False) 69 | scene_helper.add_light_modifier(light = mylight, target = True, gsg_link = True, rand_color = True) 70 | 71 | ### == Tag == ### 72 | # Add a Cude object and an Octane tag with layerID 2 73 | cube = c4d.BaseObject(c4d.Ocube) 74 | scene_helper.add_object_tag(node=cube, layerID=2) 75 | doc.InsertObject(cube) 76 | # Add a Sphere object and an Octane tag with custom aov id 2 77 | sphere = c4d.BaseObject(c4d.Osphere) 78 | scene_helper.add_custom_aov_tag(node=sphere, aovID=2) 79 | doc.InsertObject(sphere) 80 | # Add a Camera object and an Octane cam tag, then copy render setting data to it 81 | cam = c4d.BaseObject(c4d.Ocamera) 82 | doc.InsertObject(cam) 83 | camtag = scene_helper.add_camera_tag(node=cam) 84 | 85 | ### == Object == ### 86 | # Add a scatter obejct with some children and count 12345 87 | generate_object = c4d.BaseObject(c4d.Oplane) 88 | doc.InsertObject(generate_object) 89 | scatter_A = c4d.BaseObject(c4d.Oplatonic) 90 | scatter_B = c4d.BaseObject(c4d.Ooiltank) 91 | doc.InsertObject(scatter_A) 92 | doc.InsertObject(scatter_B) 93 | scatters: list[c4d.BaseObject] = [scatter_A, scatter_B] 94 | scene_helper.add_scatter(generator_node=generate_object, scatter_nodes=scatters, count=12345) 95 | 96 | # Add a object and set auto proxy 97 | the_object = c4d.BaseObject(c4d.Oplane) 98 | doc.InsertObject(the_object) 99 | the_object.SetName("Original Object") 100 | scene_helper.auto_proxy(nodes=the_object,remove_objects=False) 101 | 102 | # How to create and modify arnold scene 103 | def modify_arnold_scene(): 104 | 105 | # Get the doc host the scene, in this case th active doc 106 | doc: c4d.documents.BaseDocument = c4d.documents.GetActiveDocument() 107 | # Set arnold SceneHelper instance 108 | scene_helper = Arnold.Scene(doc) 109 | 110 | ### == Light == ### 111 | # Add a rig of hdr and rgb backdrop 112 | hdr_url: str = tex_helper.GetAssetStr(maxon.Id("file_d21cf4cfdec8c636")) 113 | scene_helper.add_dome_rig(texture_path = hdr_url, rgb = c4d.Vector(0,0,0)) 114 | 115 | # Add a light object and and some modify tags 116 | gobo_url: maxon.Url = tex_helper.GetAssetUrl("file_66b116a34a150e7e") 117 | gobo_light = scene_helper.add_gobo(texture_path = str(gobo_url), intensity=2, exposure=0) 118 | scene_helper.add_light_modifier(light = gobo_light, gsg_link = True, rand_color = True) 119 | 120 | # Add a IES light 121 | ies_url: str = tex_helper.GetAssetStr("file_6f300f2ba077da4a") 122 | ies = scene_helper.add_ies(texture_path = ies_url, intensity=1, exposure=0) 123 | 124 | ### == Tag == ### 125 | # Add a Cude object and an arnold tag with mask_name 126 | cube = c4d.BaseObject(c4d.Ocube) 127 | scene_helper.add_mask_tag(node=cube, mask_name='My Mask 01') 128 | doc.InsertObject(cube) 129 | 130 | ### == Object == ### 131 | # Add a scatter obejct with some children and count 12345 132 | generate_object = c4d.BaseObject(c4d.Oplane) 133 | doc.InsertObject(generate_object) 134 | scatter_A = c4d.BaseObject(c4d.Oplatonic) 135 | scatter_B = c4d.BaseObject(c4d.Ooiltank) 136 | doc.InsertObject(scatter_A) 137 | doc.InsertObject(scatter_B) 138 | scatters: list[c4d.BaseObject] = [scatter_A, scatter_B] 139 | scene_helper.add_scatter(generator_node=generate_object, scatter_nodes=scatters, count=12345) 140 | 141 | # Add a object and set auto proxy 142 | the_object = c4d.BaseObject(c4d.Oplane) 143 | doc.InsertObject(the_object) 144 | the_object.SetName("Original Object") 145 | scene_helper.auto_proxy(nodes=the_object,remove_objects=False) 146 | 147 | if __name__ == '__main__': 148 | Renderer.ClearConsole() 149 | modify_redshift_scene() 150 | # modify_octane_scene() 151 | # modify_arnold_scene() 152 | c4d.EventAdd() -------------------------------------------------------------------------------- /tests/__init__.py: -------------------------------------------------------------------------------- 1 | #!c4dpy 2 | # -*- coding: utf-8 -*- 3 | 4 | from test_constants import * 5 | -------------------------------------------------------------------------------- /utils/__init__.py: -------------------------------------------------------------------------------- 1 | #!c4dpy 2 | # -*- coding: utf-8 -*- 3 | 4 | """Provides classes that expose commonly used constants as immutable objects. 5 | """ 6 | import c4d 7 | from typing import Union, Optional 8 | import Renderer 9 | from Renderer.utils.node_helper import NodeGraghHelper, EasyTransaction 10 | from Renderer.utils.texture_helper import TextureHelper 11 | 12 | ID_PREFERENCES_NODE = 465001632 # prefs ID 13 | 14 | def GetPreferenceDescID(pname: str) -> None: 15 | prefs = c4d.plugins.FindPlugin(ID_PREFERENCES_NODE) 16 | if not isinstance(prefs, c4d.BaseList2D): 17 | raise RuntimeError("Could not access preferences node.") 18 | 19 | for bc, descid, _ in prefs.GetDescription(0): 20 | name = bc[c4d.DESC_NAME] 21 | if pname in name: 22 | print(name) 23 | print(descid) -------------------------------------------------------------------------------- /versions/NOTE.md: -------------------------------------------------------------------------------- 1 | ## Deprecated 2 | 3 | Note that this package is deprecated and stop update anymore, use Renderer instead. 4 | 5 | Renderer is the upgraded version of renderEngine. 6 | 7 | ## 弃用 8 | 9 | 请注意,此包已弃用,不再更新,请使用 Renderer 代替。 10 | Renderer 是 renderEngine 的升级版。 -------------------------------------------------------------------------------- /versions/ReadME.md: -------------------------------------------------------------------------------- 1 | ## Deprecated 2 | 3 | Note that this package is deprecated and stop update anymore, use Renderer instead. 4 | 5 | Renderer is the upgraded version of renderEngine. 6 | 7 | ## 弃用 8 | 9 | 请注意,此包已弃用,不再更新,请使用 Renderer 代替。 10 | Renderer 是 renderEngine 的升级版。 -------------------------------------------------------------------------------- /versions/renderEngine/ReadME.md: -------------------------------------------------------------------------------- 1 | # renderEngine 2 | This is a custom api for most popular render engine like Octane\Redshift\Arnold in Cinema 4D, which is also wiil contains in 'boghma' library. 3 | ``` 4 | All the boghma plugins and boghma library is FREE. 5 | ``` 6 | 7 | ## Installation 8 | To use this library, you have two options: 9 | 10 | 1. (**Recommend**) You can also download [Boghma Plugin Manager](https://github.com/DunHouGo/Boghma-Plugin-HUB) and install any plugin, the boghma lib will auto installed. 11 | 2. Download the source and import it to your Cinema 4D. 12 | 13 | # Limit 14 | - Due to Otoy use a custom userarea for the node editor, and don't support python. We can not get the selection of the node edtor, so it is not possible to interact with node editor. 15 | - Redshift and Arnold material helper only support NodeGragh, so the Cinema 4D before R26 is not support. 16 | - AddChild() and AddTextureTree() may return a not auto-layout node network now(Modify material). 17 | - GetID() is broken, wait Maxon fix it, GetParamDataTypeID() can not get vector id. 18 | - Arnold mask tag SetPrameter has a refresh bug. 19 | 20 | 21 | # Examples 22 | - [__Octane Example__](./octane/octane_examples.py) 23 | - [__Redshift Example__](./redshift/redshift_examples.py) 24 | - [__Arnold Example__](./arnold/arnold_examples.py) 25 | 26 | 27 | # Class Presentation 28 | 29 | ## [node_helper](./node_helper.md) 30 | - __NodeGraghHelper__ : helper class for Cinema 4D NodeGragh. 31 | - __TexPack__ : helper class to get texture data. 32 | - __methods__ : helper functions. 33 | - get_all_nodes 34 | - get_nodes 35 | - get_tags 36 | - get_selection_tag 37 | - get_materials 38 | - get_texture_tag 39 | - select_all_materials 40 | - deselect_all_materials 41 | - get_asset_url 42 | - get_asset_str 43 | - iter_node 44 | - generate_random_color 45 | 46 | ## [octane_helper](./octane/Octane.md) 47 | - __octane_id__ : unique ids for octane object, and name map of aovs. 48 | - __octane_helper__ : all the helper class and function. 49 | - methods 50 | - VideoPostHelper (class) 51 | - AOVHelper (class) 52 | - NodeHelper (class) 53 | - MaterialHelper (class) 54 | - SceneHelper (class) 55 | 56 | ## [redshift_helper](./redshift/Redshift.md) 57 | - __redshift__ : unique ids for redshift object, and name map of aovs. 58 | - __redshift_helper__ : all the helper class and function. 59 | - methods 60 | - VideoPostHelper (class) 61 | - AOVHelper (class) 62 | - MaterialHelper (class) 63 | - RSMaterialTransaction (class) 64 | - SceneHelper (class) 65 | 66 | ## [arnold_helper](./arnold/Arnold.md) 67 | - __arnold__ : unique ids for arnold object, and name map of aovs. 68 | - __arnold_helper__ : all the helper class and function. 69 | - methods 70 | - VideoPostHelper (class) 71 | - AOVHelper (class) 72 | - MaterialHelper (class) 73 | - SceneHelper (class) 74 | - ArnoldShaderLinkCustomData (class) 75 | - ArnoldVColorCustomData (class) 76 | 77 | # Version & Updates 78 | - ### 0.1.0 79 | - octane_helper and node_helper is beta now. (update@2023.06.30) 80 | - ### 0.1.1 81 | - redshift_helper is beta now. (update@2023.07.04) 82 | - add undo to octane_helper and fix some typing mistakes. 83 | - add **get_asset_url** and **get_asset_str** to node_helper. 84 | - fix some decision and add some desciption. 85 | - ### 0.1.2 86 | - arnold_helper is beta now. (update@2023.07.12) 87 | - add **iter_node** and **generate_random_color** to node_helper. 88 | - **GetPort**(get outport mode) now working with arnold. 89 | - fix some typing mistakes. 90 | - ### 0.1.3 91 | - renderEngine is beta now. (update@2023.07.16) 92 | - remove all the **AOVData** class and **read_aov** function(not used). 93 | - add **AddConnectShader** to node_helper 94 | - re-write redshift **MaterialHelper** with AddConnectShader. 95 | - re-name some redshift_helper basic functions to match arnold_helper. 96 | - ### 1.0.0 97 | - renderEngine version 1.0.0 (update@2023.07.16) 98 | - ### 1.0.1 99 | - AovManager for arnold now have a condition. (update@2023.07.17) 100 | - fix some typing mistakes. 101 | - add **setup_cryptomatte** to arnold AOVHelper. 102 | - add **CreateCryptomatte** to arnold MaterialHelper. 103 | - ### 1.0.2 104 | - AovManager for arnold now have a condition. (update@2023.07.25) 105 | - fix some typing mistakes. 106 | - add **CreateRSMaterial** to redshift MaterialHelper. 107 | - update **CreateStandardSurface** for redshift MaterialHelper. 108 | - ### 1.0.3 109 | - add **set_tag_texture** to octane SceneHelper.(update@2023.07.27) 110 | - add **set_tag_color** to octane SceneHelper. 111 | - add **get_tag** to octane SceneHelper. 112 | - add **get_tex_folder** to node_helper. 113 | - add **get_texture_path** to node_helper. 114 | - ### 1.0.4 115 | - rename **Node** functions to Capitalize. 116 | - add **IsNode** and **IsPort** to node_helper. 117 | - add **GetPreNode** and **GetPreNodes** to node_helper. 118 | - add **GetNextNode** and **GetNextNodes** to node_helper. 119 | - add **GetPreNodePorts** and **GetNextNodePorts** to node_helper. 120 | - add **GetAllConnectedPorts** and **OnSameNode** to node_helper. 121 | - add **IsNodeConnected** and **IsPortConnected** to node_helper. 122 | - re-write **RemoveConnection** in node_helper 123 | - add **IsConnected** to node_helper. 124 | - add **InsertShader** to node_helper. 125 | - util functions in node_helper remove transaction. 126 | - add **GetConnectedNodeName** to node_helper. 127 | - add **GetConnectedNodeType** to node_helper. 128 | 129 | - ### 1.0.5 130 | - fix symbols | to Union in octane_helper to balance incompatible with sdk berfore 2023.2.0. 131 | 132 | - ### 1.1.0 133 | - change symbols | to Union in all the helpers(to balance incompatible with sdk berfore 2023.2.0.). 134 | - rename **TePack** to **TextureHelper** in node_helper. 135 | - add some functions to **TextureHelper**. 136 | - ShowAssetInBrowser 137 | - GetAsset 138 | - GetAssetId 139 | - GetAssetUrl 140 | - GetAssetStr 141 | - GetAssetName 142 | - IsAsset 143 | - IsVaildPath 144 | - GetRootTexFolder 145 | - GetTexturesSize 146 | - GetTextureList 147 | - GetAllTexturePaths 148 | - CollectAssetTexture 149 | - CollectLocalTexture 150 | - PBRFromTexture 151 | - PBRFromPath 152 | - fix the **SetupTexture** for each helper and example, and extract the texture data and name parameter. 153 | - fix the octane_id map to avoid this issue when user not installed Octane. 154 | - add a bump_mode option to **AddBump** and **AddBumpTree** to redshift_helper. 155 | - remove **get_asset_url** and **get_asset_str** from node_helper. 156 | - remove **get_tex_folder** and **get_texture_path** from node_helper. 157 | - move **GetRenderEngine** to node_helper. 158 | 159 | - ### 1.1.1 160 | - fix **GetRootBRDF** in node_helper to fit redshift and arnold. 161 | - fix a PBR bug in **PBRFromPath**. 162 | - improve **SetShaderValue** and **GetShaderValue** in node_helper. 163 | - 164 | - ### 1.1.2 165 | - fix **OpenNodeEditor** if it already opened. 166 | - fix **AddBumpTree** add a target parameter. 167 | - add **GetPortName** to node_helper. 168 | - add **export_orbx** to octane_helper. 169 | - add **iso_to_group** to octane_helper. 170 | - add a material condition to **GetRootBRDF**. 171 | - add **GetPortName** to node_helper. 172 | - add condition to **GetParamDataTypeID** codes and return typing. 173 | - add condition to **GetParamDataType** codes. 174 | - fix **add_light_aov** to octane_helper. 175 | - add a **remove_light_aov** to octane_helper. 176 | 177 | - ### 1.1.3 178 | - add a remove_wires argument to **AddConnectShader**. 179 | - add a material condition to **GetRootBRDF**. 180 | - add a keep_wire argument to **RemoveShader**. 181 | - fix **GetPort** with redshift. 182 | - add **GetConnectedPortsBefore** to node_helper. 183 | - add **GetConnectedPortsAfter** to node_helper. 184 | 185 | - ### 1.1.4 186 | - add **AddUniTransform** to redshift_helper. 187 | - add **AddValue** to redshift_helper. 188 | 189 | --- 190 | - __coming soon...__ -------------------------------------------------------------------------------- /versions/renderEngine/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | # Develop for Maxon Cinema 4D version 2023.2.0 4 | # ++> Octane Render version 2022.1.1 5 | 6 | ### ========== Copyrights ========== ### 7 | 8 | """ 9 | Copyright [2023] [DunHouGo] 10 | 11 | Licensed under the Apache License, Version 2.0 (the "License"); 12 | you may not use this file except in compliance with the License. 13 | You may obtain a copy of the License at 14 | 15 | http://www.apache.org/licenses/LICENSE-2.0 16 | 17 | Unless required by applicable law or agreed to in writing, software 18 | distributed under the License is distributed on an "AS IS" BASIS, 19 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 | See the License for the specific language governing permissions and 21 | limitations under the License. 22 | """ 23 | 24 | ### ========== INFO ========== ### 25 | 26 | __author__ = "DunHouGo" 27 | __copyright__ = "Copyright (C) 2023 Boghma" 28 | __website__ = "https://www.boghma.com/" 29 | __license__ = "Apache-2.0 License" 30 | __version__ = "1.0.3" 31 | 32 | from . import octane, redshift, arnold, node_helper -------------------------------------------------------------------------------- /versions/renderEngine/arnold/Arnold.md: -------------------------------------------------------------------------------- 1 | # Arnold 2 | This is a custom api for Arnold Render in Cinema 4D, which is also wiil contains in 'boghma' library. This is a free lib for our boghma plugins with c4d. 3 | 4 | To use this library, you need to download the source or download Boghma Plugin Manager and install the latest version. Downlad from: https://www.boghma.com (not done yet) and install any plugin, the boghma lib will auto installed. 5 | 6 | # Limit 7 | - AddChild() and AddTextureTree() will return a not auto-layout node network now. 8 | - GetID() is broken, wait Maxon fix it, GetParamDataTypeID() can not get vector id 9 | 10 | # Class Presentation 11 | 12 | ## Arnold_id 13 | #### This Class contains unique ids for Arnold object, and name map of aovs. 14 | 15 | ## Arnold_helper 16 | #### This Class contains the functions for the library. And it has some children Classes. 17 | - __Functions(functions)__ 18 | - __VideoPostHelper__ 19 | - __AOVHelper__ 20 | - __ArnoldShaderLinkCustomData(same as offical)__ 21 | - __ArnoldVColorCustomData(same as offical)__ 22 | - __MaterialHelper__ 23 | - __ARMaterialTransaction__ 24 | - __SceneHelper__ 25 | 26 | ### Arnold Class/method highlighted: 27 | 28 | #### This Class contains methods for the library. It has the following methods: 29 | - __GetPreference__ : Get the Arnold preference. 30 | - __IsNodeBased__ : Check if in Arnold and use node material mode. 31 | - __SetMaterialPreview__ : Set material preview mode, default to 'when render is idle'. 32 | - __GetRenderEngine__ : Return current render engine ID. 33 | - __GetVersion__ : Get the version number of Arnold. 34 | - __GetCoreVersion__ : Get the core version number of Arnold. 35 | - __OpenIPR__ : Open Render View. 36 | - __OpenNodeEditor__ : Open Node Editor for given material. 37 | - __AovManager__ : Open aov Manager of given driver of driver type. 38 | - __TextureManager__ : Open Arnold Texture Manager. 39 | - __LightManager__ : Check if in Arnold and use node material mode. 40 | 41 | 42 | ### AOVHelper Class/method highlighted: 43 | - __get_driver__ : Get the top arnold driver of given driver type. 44 | - __get_dispaly_driver__ : Get dispaly arnold drivers in the scene. 45 | - __set_driver_path__ : Set driver render path. 46 | - __create_aov_driver__ : Create a Driver of Arnold aov. 47 | - __create_aov_shader__ : Create a shader of Arnold aov. 48 | - __add_aov__ : Add the Arnold aov shader to Arnold Driver. 49 | - __get_aovs__ : Get all the aovs of given driver in a list. 50 | - __get_aov__ : Get the aov of given name of the driver. 51 | - __print_aov__ : Print main info of existed aov in python console. 52 | - __set_driver_mode__ : Set the driver render mode. 53 | - __remove_last_aov__ : Remove the last aov shader. 54 | - __remove_all_aov__ : Remove all the aov shaders. 55 | - __remove_aov_type__ : Remove aovs of the given aov type. 56 | 57 | 58 | ### MaterialHelper Class/method highlighted: 59 | 60 | - __Create__ : Create an Arnold material(output) of given name. 61 | - __CreateStandardSurface__ : Create an Arnold Standard Surface material of given name. 62 | - __InsertMaterial__ : Insert the material to the document. 63 | - __Refresh__ : Refresh thumbnail. 64 | - __SetActive__ : Set the material active in the document. 65 | - __SetupTextures__ : Setup a pbr material with given or selected texture. 66 | - __FastPreview__ : Set material preview to 64x64 or default. 67 | 68 | - __AddShader__ : Add a shader to the material of the given id. 69 | 70 | - __AddColorJitter__ : Adds a new color jitter shader to the graph. 71 | - __AddAddShuffle__ : Adds a new shuffle shader to the graph. 72 | - __AddColorConvert__ : Adds a new Color Convert shader to the graph. 73 | - __AddColorCorrect__ : Adds a new Color Correct shader to the graph. 74 | 75 | 76 | - __AddMathAdd__ : Adds a new Math Add shader to the graph. 77 | - __AddMathSub__ : Adds a new Math Sub shader to the graph. 78 | - __AddMathMul__ : Adds a new Math Mul shader to the graph. 79 | - __AddMathDiv__ : Adds a new Math Div shader to the graph. 80 | - __AddMathNegate__ : Adds a new Math Negate shader to the graph. 81 | - __AddMathRange__ : Adds a new Math Range shader to the graph. 82 | - __AddMathNormalize__ : Adds a new Math Normalize shader to the graph. 83 | - __AddMathvalue__ : Adds a new Math value shader to the graph. 84 | - __AddMathCompare__ : Adds a new Math Compare shader to the graph. 85 | - __AddMathAbs__ : Adds a new Math Abs shader to the graph. 86 | - __AddMathMin__ : Adds a new Math Min shader to the graph. 87 | - __AddMathMax__ : Adds a new Math Max shader to the graph. 88 | 89 | - __AddNormal__ : Adds a new normal shader to the graph. 90 | - __AddBump2d__ : Adds a new Bump2d shader to the graph. 91 | - __AddBump3d__ : Adds a new Bump3d shader to the graph. 92 | - __AddDisplacement__ : Adds a new displacement shader to the graph. 93 | 94 | - __AddLayerRgba__ : Adds a new LayerRgba shader to the graph. 95 | - __AddLayerFloat__ : Adds a new LayerFloat shader to the graph. 96 | - __AddRoundCorner__ : Adds a new Round Corner shader to the graph. 97 | 98 | - __AddFresnel__ : Adds a new Fresnel shader to the graph. 99 | - __AddAO__ : Adds a new AO shader to the graph. 100 | - __AddCurvature__ : Adds a new Curvature shader to the graph. 101 | - __AddFlakes__ : Adds a new Flakes shader to the graph. 102 | - __AddPointAttribute__ : Adds a new Point Attribute shader to the graph. 103 | - __AddVertexAttribute__ : Adds a new Vertex Attribute shader to the graph. 104 | 105 | - __AddRampRGB__ : Adds a new RampRGB shader to the graph. 106 | - __AddRampFloat__ : Adds a new RampFloat shader to the graph. 107 | - __AddTriPlanar__ : Adds a new TriPlanar shader to the graph. 108 | - __AddMaxonNoise__ : Adds a new maxonnoise shader to the graph. 109 | - __AddTexture__ : Adds a new texture shader to the graph. 110 | 111 | 112 | - __AddtoOutput__ : Add a Displacement shader to the given slot(option). 113 | - __AddtoDisplacement__ : Add a Displacement shader to the given slot(option). 114 | 115 | - __AddTextureTree__ : Adds a texture tree (tex + color correction + ramp) to the graph. 116 | - __AddDisplacementTree__ : Adds a displacement tree (tex + displacement) to the graph. 117 | - __AddBumpTree__ :Adds a bump tree (tex + bump) to the graph. 118 | - __AddNoramlTree__ :Adds a normal tree (tex + normal) to the graph. 119 | 120 | ### SceneHelper Class/method highlighted: 121 | 122 | - __set_link__ : Set links to given hdr or light. 123 | - __add_hdr_dome__ : Add a texture (hdr) dome light to the scene. 124 | - __add_rgb_dome__ : Add a rgb dome light to the scene. 125 | - __add_dome_rig__ : Add a HDR and visible dome light folder. 126 | - __add_light__ : Add an Arnold light to the secne. 127 | - __add_light_texture__ : Add textures to given Arnold light tag. 128 | - __add_ies__ : Add an Arnold ies light to the secne. 129 | - __add_gobo__ : Add an Arnold gobo light to the secne. 130 | - __add_sun__ : Add an Arnold sun light to the secne. 131 | - __add_light_modifier__ : Add some modify tagsto given Arnold light tag. 132 | 133 | - __add_object_tag__ : Add an object tag to the given object. 134 | - __add_mask_tag__ : Add object mask tags to the given object(with name). 135 | - __add_camera_tag__ : Add camera tag to the given camera. 136 | 137 | - __add_scatter__ : Add a scatter object of given generator_node and scatter_nodes[selection optional]. 138 | - __add_vdb__ : Add an arnold volume object. 139 | - __add_proxy__ : Add an arnold proxy object. 140 | - __auto_proxy__ : Export objects and replace with proxy (center axis). 141 | 142 | # Eaxmple 143 | 1. __VideoPostHelper__ : Get the renderer id and version, set the render settings. 144 | 2. __AOVHelper__ : Add/Remove/Set/Get aovs, and print aov info. 145 | 3. __MaterialHelper__ : Create an Arnold material with nodes and pbr material setup. 146 | 4. __SceneHelper__ : Create lights/tags/objects. 147 | 5. __PrintID__ : Print some ID with helper class (R2023 above just copy 'id' form node editor is easy) 148 | 149 | 150 | 151 | -------------------------------------------------------------------------------- /versions/renderEngine/arnold/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DunHouGo/renderEngine/44ca8f927b6594f294ed0c5061c26ca781dd02e7/versions/renderEngine/arnold/__init__.py -------------------------------------------------------------------------------- /versions/renderEngine/arnold/arnold_example.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | # Maxon Cinema 4D version 2023.2.1 4 | 5 | ### ========== Copyrights ========== ### 6 | 7 | """ 8 | Copyright [2023] [DunHouGo] 9 | 10 | Licensed under the Apache License, Version 2.0 (the "License"); 11 | you may not use this file except in compliance with the License. 12 | You may obtain a copy of the License at 13 | 14 | http://www.apache.org/licenses/LICENSE-2.0 15 | 16 | Unless required by applicable law or agreed to in writing, software 17 | distributed under the License is distributed on an "AS IS" BASIS, 18 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | See the License for the specific language governing permissions and 20 | limitations under the License. 21 | """ 22 | 23 | ### ========== Author INFO ========== ### 24 | __author__ = "DunHouGo" 25 | __copyright__ = "Copyright (C) 2023 Boghma" 26 | __license__ = "Apache-2.0 License" 27 | __version__ = "2023.2.1" 28 | ### ========== Import Libs ========== ### 29 | from typing import Optional 30 | import c4d,maxon 31 | from importlib import reload 32 | from renderEngine.arnold import arnold_helper as ar 33 | reload(ar) 34 | from pprint import pprint 35 | try: 36 | from arnold_id import * 37 | except: 38 | from renderEngine.arnold.arnold_id import * 39 | from renderEngine import node_helper 40 | reload(node_helper) 41 | 42 | 43 | #============================================= 44 | # Examples 45 | #============================================= 46 | 47 | #--------------------------------------------------------- 48 | # Example 01 49 | # VideoPostHelper 50 | #--------------------------------------------------------- 51 | def example_01_videopost(): 52 | # Get the RenderEngine id. 53 | print(f'Current render engine ID : {ar.GetRenderEngine(doc)}.') 54 | # Get the current render version. 55 | print(f'Current render engine version : {ar.GetVersion()}.') 56 | # Get the arnold core version. 57 | print(f'Current arnold core version : {ar.GetCoreVersion()}.') 58 | # Set the VideoPostHelper instance 59 | print(f'This is a VideoPostHelper instance of : {ar.VideoPostHelper(doc)}.') 60 | 61 | #--------------------------------------------------------- 62 | # Example 02 63 | # AOVHelper 64 | #--------------------------------------------------------- 65 | def example_02_aovs(): 66 | # Get arnold videopost 67 | videopost: c4d.documents.BaseVideoPost = ar.VideoPostHelper(doc).videopost 68 | # Set arnold AOVHelper instance 69 | aov_helper: ar.AOVHelper = ar.AOVHelper(videopost) 70 | 71 | # Start record undo 72 | aov_helper.doc.StartUndo() 73 | 74 | # Create a arnold Driver item 75 | exr_driver: c4d.BaseObject = aov_helper.create_aov_driver(isDisplay=False,driver_type=C4DAIN_DRIVER_EXR,denoise=True,sRGB=False) 76 | display_driver: c4d.BaseObject = aov_helper.create_aov_driver(isDisplay=True) 77 | 78 | # Create a arnold aov item(aov type must as same as the aov manager aov) 79 | # If #name is None, defulat to #beauty. 80 | diff_aov: c4d.BaseObject = aov_helper.create_aov_shader(aov_name='diffuse') 81 | # Add the DIFFUSE aov just created to the arnold aov system 82 | aov_helper.add_aov(driver=exr_driver,aov=diff_aov) 83 | 84 | # Add some aovs to exr_driver 85 | aov_helper.add_aov(exr_driver,aov_helper.create_aov_shader("N")) 86 | aov_helper.add_aov(exr_driver,aov_helper.create_aov_shader("Z")) 87 | aov_helper.add_aov(exr_driver,aov_helper.create_aov_shader("sheen")) 88 | aov_helper.add_aov(exr_driver,aov_helper.create_aov_shader("specular")) 89 | aov_helper.add_aov(exr_driver,aov_helper.create_aov_shader("transmission")) 90 | aov_helper.add_aov(exr_driver,aov_helper.create_aov_shader("emission")) 91 | aov_helper.add_aov(exr_driver,aov_helper.create_aov_shader("coat")) 92 | last_aov: c4d.BaseObject = aov_helper.add_aov(exr_driver,aov_helper.create_aov_shader("sss")) 93 | last_name: str = last_aov.GetName() 94 | 95 | # Add some aovs to display_driver 96 | aov_helper.add_aov(display_driver,aov_helper.create_aov_shader("N")) 97 | aov_helper.add_aov(display_driver,aov_helper.create_aov_shader("Z")) 98 | 99 | # Find driver 100 | print(f"We have an exr driver called{aov_helper.get_driver('EXR').GetName()}") 101 | print(f"We also have a dispaly driver called{aov_helper.get_dispaly_driver().GetName()}") 102 | 103 | # Set exr_driver render path 104 | aov_helper.set_driver_path(exr_driver,r"C:\Users\DunHou\Desktop\DelMe") 105 | 106 | # Get all aovs of exr_driver 107 | pprint(aov_helper.get_aovs(exr_driver)) 108 | 109 | # Remove last aov: sss 110 | aov_helper.remove_last_aov(exr_driver) 111 | print(f'We remove the last AOV named: {last_name}') 112 | 113 | # Remove specified aov: N of display_driver 114 | aov_helper.remove_aov_type(display_driver,'N') 115 | print('We remove the AOV type: N of the display_driver') 116 | 117 | # Get the #emission aov and his #name 118 | emission = aov_helper.get_aov(exr_driver,'emission') 119 | if emission: 120 | print(f'We find a AOV with Named {emission.GetName()}') 121 | 122 | # Print current aov info 123 | aov_helper.print_aov() 124 | 125 | # End record undo 126 | aov_helper.doc.EndUndo() 127 | 128 | #--------------------------------------------------------- 129 | # Example 03 130 | # MaterialHelper 131 | #--------------------------------------------------------- 132 | if ar.IsNodeBased(): 133 | 134 | #--------------------------------------------------------- 135 | # Example 01 136 | # 创建材质 137 | # Standard Surface 138 | #--------------------------------------------------------- 139 | def CreateStandard(name): 140 | # 创建Standard Surface材质 141 | arnoldMaterial = ar.MaterialHelper.CreateStandardSurface(name) 142 | # 将Standard Surface材质引入当前Document 143 | arnoldMaterial.InsertMaterial() 144 | # 将Standard Surface材质设置为激活材质 145 | arnoldMaterial.SetActive() 146 | 147 | return arnoldMaterial.material 148 | 149 | 150 | #--------------------------------------------------------- 151 | # Example 02 152 | # 新建节点 修改属性 153 | # Add and Modify Standard Surface 154 | #--------------------------------------------------------- 155 | def AddandModify(name): 156 | arnoldMaterial = ar.MaterialHelper.CreateStandardSurface(name) 157 | 158 | # modification has to be done within a transaction 159 | with ar.ARMaterialTransaction(arnoldMaterial) as transaction: 160 | 161 | # Find brdf node (in this case : standard surface) 162 | standard_surface = arnoldMaterial.helper.GetRootBRDF() 163 | 164 | 165 | # Change a shader name 166 | arnoldMaterial.helper.SetName(standard_surface,'My BRDF Shader') 167 | 168 | # Create two noise and get their out port 169 | noise1 = arnoldMaterial.helper.AddShader('com.autodesk.arnold.shader.c4d_noise') 170 | n1_port = arnoldMaterial.helper.GetPort(noise1,'output') 171 | noise2 = arnoldMaterial.AddMaxonNoise() 172 | n2_port = arnoldMaterial.helper.GetPort(noise2,'output') 173 | 174 | # Get the specular_roughness port on the #standard_surface 175 | spc_rough = arnoldMaterial.helper.GetPort(standard_surface,'specular_roughness') 176 | 177 | # Add a #math add node and connect it between two noise shader output and specular_roughness 178 | arnoldMaterial.AddMathAdd([n1_port,n2_port], spc_rough) 179 | 180 | # # TexPath 181 | url: maxon.Url = node_helper.get_asset_url(maxon.Id("file_5b6a5fe03176444c")) 182 | base_color = arnoldMaterial.helper.GetPort(standard_surface,'base_color') 183 | spc_color = arnoldMaterial.helper.GetPort(standard_surface,'specular_color') 184 | 185 | # Add a Texture node and set a tex to it , change color space to RAW 186 | # 添加一个Texture shader , 设置贴图路径,并将色彩空间设置为RAW 187 | tex_node = arnoldMaterial.AddTexture(shadername = 'YourTex', filepath = node_helper.get_asset_url(maxon.Id("file_2e316c303b15a330")), raw = True,target_port = spc_color) 188 | arnoldMaterial.helper.SetName(tex_node,'Specular') 189 | 190 | # Add a texture tree to base color 191 | # 将纹理节点树到 base color 节点中 192 | arnoldMaterial.AddTextureTree(shadername = 'YourTex',filepath = url, raw=False,target_port = base_color) 193 | # Add a Displace tree 194 | # 将置换节点树 195 | arnoldMaterial.AddDisplacementTree(shadername = 'My Disp Tex',filepath=node_helper.get_asset_url(maxon.Id("file_6b69a957ef516e44"))) 196 | 197 | # Add a Bump tree 198 | # 将凹凸节点树 199 | arnoldMaterial.AddNormalTree(filepath=node_helper.get_asset_url(maxon.Id("file_2ceb1d8bb35c56ba"))) 200 | 201 | # 将Standard Surface材质引入当前Document 202 | arnoldMaterial.InsertMaterial() 203 | # 将Standard Surface材质设置为激活材质 204 | arnoldMaterial.SetActive() 205 | 206 | return arnoldMaterial.material 207 | 208 | #--------------------------------------------------------- 209 | # Example 03 210 | # 修改已有材质 211 | # Modify Material 212 | #--------------------------------------------------------- 213 | def ModifyMaterial(material: ar.MaterialHelper): 214 | """ 215 | This function try to modify an exsit arnold material. 216 | """ 217 | if material is None: 218 | return 219 | 220 | # for our example, the #material should be a instance of ar.MaterialHelper 221 | # then we can use our ARMaterialTransaction to modify 222 | if isinstance(material, ar.MaterialHelper): 223 | # modification has to be done within a transaction 224 | with ar.ARMaterialTransaction(material) as transaction: 225 | noise = material.AddMaxonNoise() 226 | 227 | output = material.helper.GetRootBRDF() 228 | material.helper.AddConnection(noise,'output', output, 'base_color') 229 | 230 | # for suitable for most cases, the #material can be a c4d.BaseMaterial 231 | # we can transfer it to a instance of rs.MaterialHelper 232 | # then we can use our RSMaterialTransaction to modify 233 | if isinstance(material, c4d.BaseMaterial): 234 | material = ar.MaterialHelper(material) 235 | # modification has to be done within a transaction 236 | with ar.ARMaterialTransaction(material) as transaction: 237 | noise = material.AddMaxonNoise() 238 | output = material.helper.GetRootBRDF() 239 | material.helper.AddConnection(noise,'output', output, 'base_color') 240 | 241 | return material.material 242 | 243 | #--------------------------------------------------------- 244 | # Example 04 245 | # 创建pbr材质 246 | # Create PBR Material 247 | #--------------------------------------------------------- 248 | def PBRMaterial(): 249 | arnoldMaterial = ar.MaterialHelper.CreateStandardSurface("PBR Example") 250 | arnoldMaterial.SetupTextures() 251 | # 将Standard Surface材质引入当前Document 252 | arnoldMaterial.InsertMaterial() 253 | # 将Standard Surface材质设置为激活材质 254 | arnoldMaterial.SetActive() 255 | arnoldMaterial.FastPreview() 256 | ar.OpenNodeEditor(arnoldMaterial.material) 257 | return arnoldMaterial.material 258 | 259 | 260 | #--------------------------------------------------------- 261 | # Example 04 262 | # SceneHelper 263 | #--------------------------------------------------------- 264 | def example_04_scenes(): 265 | # Set arnold SceneHelper instance 266 | scene_helper = ar.SceneHelper(doc) 267 | 268 | ### == Light == ### 269 | # Add a rig of hdr and rgb backdrop 270 | hdr_url: str = node_helper.get_asset_str(maxon.Id("file_d21cf4cfdec8c636")) 271 | scene_helper.add_dome_rig(texture_path = hdr_url, rgb = c4d.Vector(0,0,0)) 272 | 273 | # Add a light object and and some modify tags 274 | gobo_url: maxon.Url = node_helper.get_asset_url(maxon.Id("file_66b116a34a150e7e")) 275 | gobo_light = scene_helper.add_gobo(texture_path = str(gobo_url), intensity=2, exposure=0) 276 | scene_helper.add_light_modifier(light = gobo_light, gsg_link = True, rand_color = True) 277 | 278 | # Add a IES light 279 | ies_url: str = node_helper.get_asset_str("file_6f300f2ba077da4a") 280 | ies = scene_helper.add_ies(texture_path = ies_url, intensity=1, exposure=0) 281 | 282 | ### == Tag == ### 283 | # Add a Cude object and an arnold tag with mask_name 284 | cube = c4d.BaseObject(c4d.Ocube) 285 | scene_helper.add_mask_tag(node=cube, mask_name='My Mask 01') 286 | doc.InsertObject(cube) 287 | 288 | ### == Object == ### 289 | # Add a scatter obejct with some children and count 12345 290 | generate_object = c4d.BaseObject(c4d.Oplane) 291 | doc.InsertObject(generate_object) 292 | scatter_A = c4d.BaseObject(c4d.Oplatonic) 293 | scatter_B = c4d.BaseObject(c4d.Ooiltank) 294 | doc.InsertObject(scatter_A) 295 | doc.InsertObject(scatter_B) 296 | scatters: list[c4d.BaseObject] = [scatter_A, scatter_B] 297 | scene_helper.add_scatter(generator_node=generate_object, scatter_nodes=scatters, count=12345) 298 | 299 | # Add a object and set auto proxy 300 | the_object = c4d.BaseObject(c4d.Oplane) 301 | doc.InsertObject(the_object) 302 | the_object.SetName("Original Object") 303 | scene_helper.auto_proxy(node=the_object,remove_objects=False) 304 | 305 | if __name__ == '__main__': 306 | # --- 1 --- # 307 | example_01_videopost() 308 | # --- 2 --- # 309 | example_02_aovs() 310 | # --- 3 --- # 311 | example1 = CreateStandard("1.Standard Surface") 312 | example2 = AddandModify("2.Add and Modify Material") 313 | example3 = ModifyMaterial(ar.MaterialHelper(example1)) 314 | example3.SetName("3.Modify Material") 315 | example4 = PBRMaterial() 316 | # --- 4 --- # 317 | example_04_scenes() 318 | 319 | # Put Refresh 320 | c4d.EventAdd() -------------------------------------------------------------------------------- /versions/renderEngine/arnold/arnold_examples.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | # Maxon Cinema 4D version 2023.2.1 4 | 5 | ### ========== Copyrights ========== ### 6 | 7 | """ 8 | Copyright [2023] [DunHouGo] 9 | 10 | Licensed under the Apache License, Version 2.0 (the "License"); 11 | you may not use this file except in compliance with the License. 12 | You may obtain a copy of the License at 13 | 14 | http://www.apache.org/licenses/LICENSE-2.0 15 | 16 | Unless required by applicable law or agreed to in writing, software 17 | distributed under the License is distributed on an "AS IS" BASIS, 18 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | See the License for the specific language governing permissions and 20 | limitations under the License. 21 | """ 22 | 23 | ### ========== Author INFO ========== ### 24 | __author__ = "DunHouGo" 25 | __copyright__ = "Copyright (C) 2023 Boghma" 26 | __license__ = "Apache-2.0 License" 27 | __version__ = "2023.2.1" 28 | ### ========== Import Libs ========== ### 29 | from typing import Optional 30 | import c4d,maxon 31 | from importlib import reload 32 | from renderEngine.arnold import arnold_helper as ar 33 | reload(ar) 34 | from pprint import pprint 35 | try: 36 | from arnold_id import * 37 | except: 38 | from renderEngine.arnold.arnold_id import * 39 | from renderEngine import node_helper 40 | reload(node_helper) 41 | 42 | tex_helper = node_helper.TextureHelper() 43 | 44 | #============================================= 45 | # Examples 46 | #============================================= 47 | 48 | #--------------------------------------------------------- 49 | # Example 01 50 | # VideoPostHelper 51 | #--------------------------------------------------------- 52 | def example_01_videopost(): 53 | # Get the RenderEngine id. 54 | print(f'Current render engine ID : {node_helper.GetRenderEngine(doc)}.') 55 | # Get the current render version. 56 | print(f'Current render engine version : {ar.GetVersion()}.') 57 | # Get the arnold core version. 58 | print(f'Current arnold core version : {ar.GetCoreVersion()}.') 59 | # Set the VideoPostHelper instance 60 | print(f'This is a VideoPostHelper instance of : {ar.VideoPostHelper(doc)}.') 61 | 62 | #--------------------------------------------------------- 63 | # Example 02 64 | # AOVHelper 65 | #--------------------------------------------------------- 66 | def example_02_aovs(): 67 | # Get arnold videopost 68 | videopost: c4d.documents.BaseVideoPost = ar.VideoPostHelper(doc).videopost 69 | # Set arnold AOVHelper instance 70 | aov_helper: ar.AOVHelper = ar.AOVHelper(videopost) 71 | 72 | # Start record undo 73 | aov_helper.doc.StartUndo() 74 | 75 | # Create a arnold Driver item 76 | exr_driver: c4d.BaseObject = aov_helper.create_aov_driver(isDisplay=False,driver_type=C4DAIN_DRIVER_EXR,denoise=True,sRGB=False) 77 | display_driver: c4d.BaseObject = aov_helper.create_aov_driver(isDisplay=True) 78 | 79 | # Create a arnold aov item(aov type must as same as the aov manager aov) 80 | # If #name is None, defulat to #beauty. 81 | diff_aov: c4d.BaseObject = aov_helper.create_aov_shader(aov_name='diffuse') 82 | # Add the DIFFUSE aov just created to the arnold aov system 83 | aov_helper.add_aov(driver=exr_driver,aov=diff_aov) 84 | 85 | # Add some aovs to exr_driver 86 | aov_helper.add_aov(exr_driver,aov_helper.create_aov_shader("N")) 87 | aov_helper.add_aov(exr_driver,aov_helper.create_aov_shader("Z")) 88 | aov_helper.add_aov(exr_driver,aov_helper.create_aov_shader("sheen")) 89 | aov_helper.add_aov(exr_driver,aov_helper.create_aov_shader("specular")) 90 | aov_helper.add_aov(exr_driver,aov_helper.create_aov_shader("transmission")) 91 | aov_helper.add_aov(exr_driver,aov_helper.create_aov_shader("emission")) 92 | aov_helper.add_aov(exr_driver,aov_helper.create_aov_shader("coat")) 93 | last_aov: c4d.BaseObject = aov_helper.add_aov(exr_driver,aov_helper.create_aov_shader("sss")) 94 | last_name: str = last_aov.GetName() 95 | 96 | # Add some aovs to display_driver 97 | aov_helper.add_aov(display_driver,aov_helper.create_aov_shader("N")) 98 | aov_helper.add_aov(display_driver,aov_helper.create_aov_shader("Z")) 99 | 100 | # Find driver 101 | print(f"We have an exr driver called{aov_helper.get_driver('EXR').GetName()}") 102 | print(f"We also have a dispaly driver called{aov_helper.get_dispaly_driver().GetName()}") 103 | 104 | # Set exr_driver render path 105 | aov_helper.set_driver_path(exr_driver,r"C:\Users\DunHou\Desktop\DelMe") 106 | 107 | # Get all aovs of exr_driver 108 | pprint(aov_helper.get_aovs(exr_driver)) 109 | 110 | # Remove last aov: sss 111 | aov_helper.remove_last_aov(exr_driver) 112 | print(f'We remove the last AOV named: {last_name}') 113 | 114 | # Remove specified aov: N of display_driver 115 | aov_helper.remove_aov_type(display_driver,'N') 116 | print('We remove the AOV type: N of the display_driver') 117 | 118 | # Get the #emission aov and his #name 119 | emission = aov_helper.get_aov(exr_driver,'emission') 120 | if emission: 121 | print(f'We find a AOV with Named {emission.GetName()}') 122 | 123 | # Print current aov info 124 | aov_helper.print_aov() 125 | 126 | # End record undo 127 | aov_helper.doc.EndUndo() 128 | 129 | #--------------------------------------------------------- 130 | # Example 03 131 | # MaterialHelper 132 | #--------------------------------------------------------- 133 | if ar.IsNodeBased(): 134 | 135 | #--------------------------------------------------------- 136 | # Example 01 137 | # 创建材质 138 | # Standard Surface 139 | #--------------------------------------------------------- 140 | def CreateStandard(name): 141 | # 创建Standard Surface材质 142 | arnoldMaterial = ar.MaterialHelper.CreateStandardSurface(name) 143 | # 将Standard Surface材质引入当前Document 144 | arnoldMaterial.InsertMaterial() 145 | # 将Standard Surface材质设置为激活材质 146 | arnoldMaterial.SetActive() 147 | 148 | return arnoldMaterial.material 149 | 150 | 151 | #--------------------------------------------------------- 152 | # Example 02 153 | # 新建节点 修改属性 154 | # Add and Modify Standard Surface 155 | #--------------------------------------------------------- 156 | def AddandModify(name): 157 | arnoldMaterial = ar.MaterialHelper.CreateStandardSurface(name) 158 | 159 | # modification has to be done within a transaction 160 | with ar.ARMaterialTransaction(arnoldMaterial) as transaction: 161 | 162 | # Find brdf node (in this case : standard surface) 163 | standard_surface = arnoldMaterial.helper.GetRootBRDF() 164 | 165 | 166 | # Change a shader name 167 | arnoldMaterial.helper.SetName(standard_surface,'My BRDF Shader') 168 | 169 | # Create two noise and get their out port 170 | noise1 = arnoldMaterial.helper.AddShader('com.autodesk.arnold.shader.c4d_noise') 171 | n1_port = arnoldMaterial.helper.GetPort(noise1,'output') 172 | noise2 = arnoldMaterial.AddMaxonNoise() 173 | n2_port = arnoldMaterial.helper.GetPort(noise2,'output') 174 | 175 | # Get the specular_roughness port on the #standard_surface 176 | spc_rough = arnoldMaterial.helper.GetPort(standard_surface,'specular_roughness') 177 | 178 | # Add a #math add node and connect it between two noise shader output and specular_roughness 179 | arnoldMaterial.AddMathAdd([n1_port,n2_port], spc_rough) 180 | 181 | # # TexPath 182 | url: maxon.Url = tex_helper.GetAssetUrl("file_5b6a5fe03176444c") 183 | base_color = arnoldMaterial.helper.GetPort(standard_surface,'base_color') 184 | spc_color = arnoldMaterial.helper.GetPort(standard_surface,'specular_color') 185 | 186 | # Add a Texture node and set a tex to it , change color space to RAW 187 | # 添加一个Texture shader , 设置贴图路径,并将色彩空间设置为RAW 188 | tex_node = arnoldMaterial.AddTexture(shadername = 'YourTex', filepath = tex_helper.GetAssetUrl("file_2e316c303b15a330"), raw = True,target_port = spc_color) 189 | arnoldMaterial.helper.SetName(tex_node,'Specular') 190 | 191 | # Add a texture tree to base color 192 | # 将纹理节点树到 base color 节点中 193 | arnoldMaterial.AddTextureTree(shadername = 'YourTex',filepath = url, raw=False,target_port = base_color) 194 | # Add a Displace tree 195 | # 将置换节点树 196 | arnoldMaterial.AddDisplacementTree(shadername = 'My Disp Tex',filepath=tex_helper.GetAssetUrl("file_6b69a957ef516e44")) 197 | 198 | # Add a Bump tree 199 | # 将凹凸节点树 200 | arnoldMaterial.AddNormalTree(filepath=tex_helper.GetAssetUrl("file_2ceb1d8bb35c56ba")) 201 | 202 | # 将Standard Surface材质引入当前Document 203 | arnoldMaterial.InsertMaterial() 204 | # 将Standard Surface材质设置为激活材质 205 | arnoldMaterial.SetActive() 206 | 207 | return arnoldMaterial.material 208 | 209 | #--------------------------------------------------------- 210 | # Example 03 211 | # 修改已有材质 212 | # Modify Material 213 | #--------------------------------------------------------- 214 | def ModifyMaterial(material: ar.MaterialHelper): 215 | """ 216 | This function try to modify an exsit arnold material. 217 | """ 218 | if material is None: 219 | return 220 | 221 | # for our example, the #material should be a instance of ar.MaterialHelper 222 | # then we can use our ARMaterialTransaction to modify 223 | if isinstance(material, ar.MaterialHelper): 224 | # modification has to be done within a transaction 225 | with ar.ARMaterialTransaction(material) as transaction: 226 | noise = material.AddMaxonNoise() 227 | 228 | output = material.helper.GetRootBRDF() 229 | material.helper.AddConnection(noise,'output', output, 'base_color') 230 | 231 | # for suitable for most cases, the #material can be a c4d.BaseMaterial 232 | # we can transfer it to a instance of rs.MaterialHelper 233 | # then we can use our RSMaterialTransaction to modify 234 | if isinstance(material, c4d.BaseMaterial): 235 | material = ar.MaterialHelper(material) 236 | # modification has to be done within a transaction 237 | with ar.ARMaterialTransaction(material) as transaction: 238 | noise = material.AddMaxonNoise() 239 | output = material.helper.GetRootBRDF() 240 | material.helper.AddConnection(noise,'output', output, 'base_color') 241 | 242 | return material.material 243 | 244 | #--------------------------------------------------------- 245 | # Example 04 246 | # 创建pbr材质 247 | # Create PBR Material 248 | #--------------------------------------------------------- 249 | def PBRMaterial(): 250 | arnoldMaterial = ar.MaterialHelper.CreateStandardSurface("PBR Example") 251 | 252 | # 用户任意选择一张贴图, 最好不要选择albedo,而是选择Normal这种 253 | texture = c4d.storage.LoadDialog(type=c4d.FILESELECTTYPE_IMAGES, title='Select a texture',flags=c4d.FILESELECT_LOAD) 254 | if texture: 255 | texture_data = tex_helper.PBRFromTexture(texture) 256 | tex_data = texture_data[0] 257 | mat_name = texture_data[1] 258 | 259 | arnoldMaterial.SetupTextures(tex_data,mat_name) 260 | # 将Standard Surface材质引入当前Document 261 | arnoldMaterial.InsertMaterial() 262 | # 将Standard Surface材质设置为激活材质 263 | arnoldMaterial.SetActive() 264 | arnoldMaterial.FastPreview() 265 | ar.OpenNodeEditor(arnoldMaterial.material) 266 | return arnoldMaterial.material 267 | 268 | 269 | #--------------------------------------------------------- 270 | # Example 04 271 | # SceneHelper 272 | #--------------------------------------------------------- 273 | def example_04_scenes(): 274 | # Set arnold SceneHelper instance 275 | scene_helper = ar.SceneHelper(doc) 276 | 277 | ### == Light == ### 278 | # Add a rig of hdr and rgb backdrop 279 | hdr_url: str = tex_helper.GetAssetStr(maxon.Id("file_d21cf4cfdec8c636")) 280 | scene_helper.add_dome_rig(texture_path = hdr_url, rgb = c4d.Vector(0,0,0)) 281 | 282 | # Add a light object and and some modify tags 283 | gobo_url: maxon.Url = tex_helper.GetAssetUrl("file_66b116a34a150e7e") 284 | gobo_light = scene_helper.add_gobo(texture_path = str(gobo_url), intensity=2, exposure=0) 285 | scene_helper.add_light_modifier(light = gobo_light, gsg_link = True, rand_color = True) 286 | 287 | # Add a IES light 288 | ies_url: str = tex_helper.GetAssetStr("file_6f300f2ba077da4a") 289 | ies = scene_helper.add_ies(texture_path = ies_url, intensity=1, exposure=0) 290 | 291 | ### == Tag == ### 292 | # Add a Cude object and an arnold tag with mask_name 293 | cube = c4d.BaseObject(c4d.Ocube) 294 | scene_helper.add_mask_tag(node=cube, mask_name='My Mask 01') 295 | doc.InsertObject(cube) 296 | 297 | ### == Object == ### 298 | # Add a scatter obejct with some children and count 12345 299 | generate_object = c4d.BaseObject(c4d.Oplane) 300 | doc.InsertObject(generate_object) 301 | scatter_A = c4d.BaseObject(c4d.Oplatonic) 302 | scatter_B = c4d.BaseObject(c4d.Ooiltank) 303 | doc.InsertObject(scatter_A) 304 | doc.InsertObject(scatter_B) 305 | scatters: list[c4d.BaseObject] = [scatter_A, scatter_B] 306 | scene_helper.add_scatter(generator_node=generate_object, scatter_nodes=scatters, count=12345) 307 | 308 | # Add a object and set auto proxy 309 | the_object = c4d.BaseObject(c4d.Oplane) 310 | doc.InsertObject(the_object) 311 | the_object.SetName("Original Object") 312 | scene_helper.auto_proxy(node=the_object,remove_objects=False) 313 | 314 | if __name__ == '__main__': 315 | # --- 1 --- # 316 | example_01_videopost() 317 | # --- 2 --- # 318 | example_02_aovs() 319 | # --- 3 --- # 320 | example1 = CreateStandard("1.Standard Surface") 321 | example2 = AddandModify("2.Add and Modify Material") 322 | example3 = ModifyMaterial(ar.MaterialHelper(example1)) 323 | example3.SetName("3.Modify Material") 324 | example4 = PBRMaterial() 325 | # --- 4 --- # 326 | example_04_scenes() 327 | 328 | # Put Refresh 329 | c4d.EventAdd() -------------------------------------------------------------------------------- /versions/renderEngine/arnold/arnold_id.py: -------------------------------------------------------------------------------- 1 | import c4d 2 | 3 | # arnold 4 | AR_NODESPACE = "com.autodesk.arnold.nodespace" 5 | AR_SHADER_PREFIX = "com.autodesk.arnold.shader." 6 | 7 | # material id 8 | ARNOLD_SHADER_NETWORK = 1033991 9 | 10 | # root port ids 11 | ARNOLD_SHADER_PORT_ID = 537905099 12 | ARNOLD_DISPLACEMENT_PORT_ID = 537905100 13 | ARNOLD_VIEWPORT_PORT_ID = 537906863 14 | ARNOLD_HISTOGRAM_PORT_ID = 537908968 15 | ARNOLD_VCOLOR_DATATYPE_LEGACYID = 1035785 16 | ARNOLD_VCOLOR_DATATYPE = "com.autodesk.arnold.datatype.vcolor" 17 | 18 | C4DAI_SHADERLINK_CONTAINER = 9988000 19 | C4DAI_SHADERLINK_TYPE = 101 20 | C4DAI_SHADERLINK_VALUE = 102 21 | C4DAI_SHADERLINK_TEXTURE = 103 22 | C4DAI_SHADERLINK_MATERIAL = 104 23 | 24 | C4DAI_GVC4DSHADER_BITMAP_COLOR_SPACE = 10101 25 | 26 | C4DTOA_MSG_GET_NODEMATERIAL_CUSTOMDATA = 1093 27 | C4DTOA_MSG_SET_NODEMATERIAL_CUSTOMDATA = 1094 28 | 29 | ARNOLD_SCENE_HOOK = 1032309 30 | # output component ids 31 | ARNOLD_PARAMCOMP_R = 1 32 | ARNOLD_PARAMCOMP_G = 2 33 | ARNOLD_PARAMCOMP_B = 3 34 | ARNOLD_PARAMCOMP_A = 4 35 | ARNOLD_PARAMCOMP_X = 5 36 | ARNOLD_PARAMCOMP_Y = 6 37 | ARNOLD_PARAMCOMP_Z = 7 38 | 39 | # message ids 40 | C4DTOA_MSG_TYPE = 1000 41 | C4DTOA_MSG_PARAM1 = 2001 42 | C4DTOA_MSG_PARAM2 = 2002 43 | C4DTOA_MSG_PARAM3 = 2003 44 | C4DTOA_MSG_PARAM4 = 2004 45 | C4DTOA_MSG_PARAM5 = 2005 46 | C4DTOA_MSG_RESP1 = 2011 47 | C4DTOA_MSG_RESP2 = 2012 48 | C4DTOA_MSG_RESP3 = 2013 49 | C4DTOA_MSG_RESP4 = 2014 50 | C4DTOA_MSG_QUERY_SHADER_NETWORK = 1028 51 | C4DTOA_MSG_ADD_SHADER = 1029 52 | C4DTOA_MSG_REMOVE_SHADER = 1030 53 | C4DTOA_MSG_ADD_CONNECTION = 1031 54 | C4DTOA_MSG_REMOVE_CONNECTION = 1032 55 | C4DTOA_MSG_CONNECT_ROOT_SHADER = 1033 56 | C4DTOA_MSG_DISCONNECT_ROOT_SHADER = 1034 57 | C4DTOA_MSG_ALIGN_NODES = 1097 58 | 59 | # shader type ids 60 | ARNOLD_SHADER_GV = 1033990 61 | ARNOLD_C4D_SHADER_GV = 1034190 62 | ARNOLD_REFERENCE_GV = 1035541 63 | 64 | C4DAI_GVSHADER_TYPE = 200 65 | C4DAI_GVC4DSHADER_TYPE = 200 66 | 67 | # C4D shader ids 68 | C4DAIN_C4D_BITMAP = 904247772 69 | C4DAIN_C4D_NOISE = 218464707 70 | C4DAIN_C4D_SUBSTANCE_SHADER = 799632067 71 | C4DAIN_C4D_VERTEX_MAP = 1896336102 72 | C4DShaderIdMap = { 73 | c4d.Xbitmap: C4DAIN_C4D_BITMAP, 74 | c4d.Xnoise: C4DAIN_C4D_NOISE, 75 | c4d.Xsubstance: C4DAIN_C4D_SUBSTANCE_SHADER, 76 | c4d.Xvertexmap: C4DAIN_C4D_VERTEX_MAP, 77 | } 78 | 79 | # Arnold shader ids 80 | C4DAIN_BLACKBODY = 1326266352 81 | C4DAIN_DISPLACEMENT = 1227821282 82 | C4DAIN_LIGHT_BLOCKER = 974577342 83 | C4DAIN_OBJECT = 301260540 84 | C4DAIN_OSL = 193501779 85 | C4DAIN_RAMP_FLOAT = 1343782602 86 | C4DAIN_RAMP_RGB = 499635473 87 | C4DAIN_RANDOM = 417623846 88 | C4DAIN_REFERENCE = 1491778796 89 | C4DAIN_SHADOW_MATTE = 1432373531 90 | C4DAIN_SPACE_TRANSFORM = 778771884 91 | C4DAIN_TRIGO = 275933738 92 | C4DAIN_VALUE = 277698370 93 | C4DAIN_XPARTICLES = 206657884 94 | 95 | LIGHT_BLOCKER_SHADER_ID = 1035773 96 | OSL_SHADER_ID = 1050718 97 | BLACKBODY_SHADER_ID = 1034217 98 | RAMP_FLOAT_SHADER_ID = 1034228 99 | RAMP_RGB_SHADER_ID = 1034229 100 | RANDOM_SHADER_ID = 1034221 101 | SHADOW_MATTE_SHADER_ID = 1034222 102 | SPACE_TRANSFORM_SHADER_ID = 1034223 103 | TRIGO_SHADER_ID = 1034226 104 | VALUE_SHADER_ID = 1054367 105 | OBJECT_SHADER_ID = 1055077 106 | XPARTICLES_SHADER_ID = 1051148 107 | DISPLACEMENT_SHADER_ID = 1051169 108 | ArnoldCustomShaderIdMap = { 109 | LIGHT_BLOCKER_SHADER_ID: C4DAIN_LIGHT_BLOCKER, 110 | OSL_SHADER_ID: C4DAIN_OSL, 111 | BLACKBODY_SHADER_ID: C4DAIN_BLACKBODY, 112 | RAMP_FLOAT_SHADER_ID: C4DAIN_RAMP_FLOAT, 113 | RAMP_RGB_SHADER_ID: C4DAIN_RAMP_RGB, 114 | RANDOM_SHADER_ID: C4DAIN_RANDOM, 115 | SHADOW_MATTE_SHADER_ID: C4DAIN_SHADOW_MATTE, 116 | SPACE_TRANSFORM_SHADER_ID: C4DAIN_SPACE_TRANSFORM, 117 | TRIGO_SHADER_ID: C4DAIN_TRIGO, 118 | VALUE_SHADER_ID: C4DAIN_VALUE, 119 | OBJECT_SHADER_ID: C4DAIN_OBJECT, 120 | XPARTICLES_SHADER_ID: C4DAIN_XPARTICLES, 121 | DISPLACEMENT_SHADER_ID: C4DAIN_DISPLACEMENT, 122 | } 123 | 124 | #tip Arnold ID 125 | # C4DtoA/api/include/c4dtoa_symbols.h 126 | ARNOLD_DRIVER = 1030141 127 | ARNOLD_AOV = 1030369 128 | 129 | # C4DtoA/api/include/util/Constants.h 130 | C4DTOA_MSG_TYPE = 1000 131 | C4DTOA_MSG_INIT_DEFAULTS = 1011 132 | 133 | # C4DtoA/api/include/util/NodeIds.h 134 | C4DAIN_DRIVER_PNG = 9492523 135 | C4DAIN_DRIVER_EXR = 9504161 136 | C4DAIN_DRIVER_TIFF = 313114887 137 | C4DAIN_DRIVER_C4D_DISPLAY = 1927516736 138 | 139 | DRIVER_NAME_MAP: dict = {1927516736: "Display driver", 140 | 1058716317: "Deep exr", 141 | 9504161: "exr", 142 | 313466666: "jpg", 143 | 9492523: "png", 144 | 313114887: "tiff" 145 | } 146 | 147 | # C4DtoA/res/description/arnold_driver.h 148 | C4DAI_DRIVER_TYPE = 101 149 | 150 | # C4DtoA/res/description/ainode_driver_***.h 151 | C4DAIP_DRIVER_EXR_FILENAME = 1285755954 152 | C4DAIP_DRIVER_DEEPEXR_FILENAME = 1429220916 153 | C4DAIP_DRIVER_JPEG_FILENAME = 766183461 154 | C4DAIP_DRIVER_PNG_FILENAME = 1807654404 155 | C4DAIP_DRIVER_TIFF_FILENAME = 1913388456 156 | C4DAIP_DRIVER_ALL_FILENAME = [ 157 | C4DAIP_DRIVER_EXR_FILENAME, 158 | C4DAIP_DRIVER_DEEPEXR_FILENAME, 159 | C4DAIP_DRIVER_JPEG_FILENAME, 160 | C4DAIP_DRIVER_PNG_FILENAME, 161 | C4DAIP_DRIVER_TIFF_FILENAME] 162 | 163 | # C4DtoA\res\description\ainode_driver_exr.h 164 | C4DAI_DRIVER_EXR_MAIN_GRP = 1000 165 | 166 | ARNOLD_DUMMY_BITMAP_SAVER = 1035823 167 | 168 | C4DAIP_DRIVER_EXR_COMPRESSION = 676823551 169 | C4DAIP_DRIVER_EXR_HALF_PRECISION = 317968755 170 | C4DAIP_DRIVER_EXR_TILED = 1109730913 171 | C4DAIP_DRIVER_EXR_MULTIPART = 2078120241 172 | C4DAIP_DRIVER_EXR_COLOR_SPACE = 1181188201 173 | C4DAIP_DRIVER_EXR_PRESERVE_LAYER_NAME = 2038455371 174 | C4DAIP_DRIVER_EXR_AUTOCROP = 987293958 175 | C4DAIP_DRIVER_EXR_APPEND = 1298458693 176 | C4DAIP_DRIVER_EXR_CUSTOM_ATTRIBUTES = 1368176590 177 | C4DAIP_DRIVER_EXR_NAME = 554454610 178 | 179 | C4DAIP_DRIVER_JPEG_COLOR_SPACE = 927936370 180 | C4DAIP_DRIVER_PNG_COLOR_SPACE = 68324877 181 | C4DAIP_DRIVER_TIFF_COLOR_SPACE = 1213105359 182 | 183 | C4DAIP_DRIVER_COLOR_SPACE = [C4DAIP_DRIVER_EXR_COLOR_SPACE, 184 | C4DAIP_DRIVER_JPEG_COLOR_SPACE, 185 | C4DAIP_DRIVER_PNG_COLOR_SPACE, 186 | C4DAIP_DRIVER_TIFF_COLOR_SPACE 187 | ] 188 | 189 | # C4DtoA/res/c4d_symbols.h 190 | ARNOLD_SCENE_EXPORT = 1029993 191 | SCENE_EXPORT_FORMAT_ASS = 193450604 192 | SCENE_EXPORT_FORMAT_USD = 193472369 193 | SCENE_EXPORT_OBJECT_MODE_ALL = 0 194 | SCENE_EXPORT_OBJECT_MODE_SELECTED = 1 195 | SCENE_EXPORT_OBJECT_MODE_SELECTED_INDIVIDUALLY = 2 196 | 197 | # C4DtoA/res/description/ainode_skydome_light.h 198 | C4DAIP_SKYDOME_LIGHT_COLOR = 268620635 199 | # C4DtoA/res/description/ainode_quad_light.h 200 | C4DAIP_QUAD_LIGHT_COLOR = 2010942260 201 | 202 | C4DAIP_DOME_LIGHT_COLOR = 1458609997 203 | 204 | C4DAIP_DRIVER_PNG_FORMAT = 775847732 205 | ARNOLD_OBJECTMASK_TAG = 1034693 206 | ARNOLD_TAG = 1029989 207 | ARNOLD_LIGHT = 1030424 208 | C4DAIN_CYLINDER_LIGHT = 1944046294 209 | C4DAIN_DISK_LIGHT = 998592185 210 | C4DAIN_DISTANT_LIGHT = 1381557517 211 | C4DAIN_MESH_LIGHT = 804868393 212 | C4DAIN_PHOTOMETRIC_LIGHT = 1980850506 213 | C4DAIN_POINT_LIGHT = 381492518 214 | C4DAIN_QUAD_LIGHT = 1218397465 215 | C4DAIN_SKYDOME_LIGHT = 2054857832 216 | C4DAIN_SPOT_LIGHT = 876943490 217 | #NOTE this is a fake node, does not exist in Arnold core 218 | C4DAIN_LIGHT_PORTAL = 1362015054 219 | 220 | # C4DtoA\res\description\ainode_quad_light.h 221 | C4DAI_QUAD_LIGHT_WIDTH = 2034436501 222 | C4DAI_QUAD_LIGHT_HEIGHT = 2120286158 223 | C4DAI_QUAD_LIGHT_AOV = 9011 224 | C4DAI_QUAD_LIGHT_LOOKAT = 100107 225 | 226 | C4DAIP_QUAD_LIGHT_VERTICES = 1675375270 227 | C4DAIP_QUAD_LIGHT_RESOLUTION = 1748091575 228 | C4DAIP_QUAD_LIGHT_ROUNDNESS = 1641633270 229 | C4DAIP_QUAD_LIGHT_SOFT_EDGE = 1632353189 230 | C4DAIP_QUAD_LIGHT_SPREAD = 1730825676 231 | C4DAIP_QUAD_LIGHT_PORTAL = 1849401433 232 | C4DAIP_QUAD_LIGHT_MATRIX = 1983340534 233 | C4DAIP_QUAD_LIGHT_COLOR = 2010942260 234 | C4DAIP_QUAD_LIGHT_INTENSITY = 67722820 235 | C4DAIP_QUAD_LIGHT_EXPOSURE = 1655166224 236 | C4DAIP_QUAD_LIGHT_CAST_SHADOWS = 1630188088 237 | C4DAIP_QUAD_LIGHT_CAST_VOLUMETRIC_SHADOWS = 1554489247 238 | C4DAIP_QUAD_LIGHT_SHADOW_DENSITY = 483322842 239 | C4DAIP_QUAD_LIGHT_SHADOW_COLOR = 1754675065 240 | C4DAIP_QUAD_LIGHT_SAMPLES = 1875225526 241 | C4DAIP_QUAD_LIGHT_NORMALIZE = 1502846298 242 | C4DAIP_QUAD_LIGHT_CAMERA = 1920007390 243 | C4DAIP_QUAD_LIGHT_TRANSMISSION = 599607935 244 | C4DAIP_QUAD_LIGHT_DIFFUSE = 532023995 245 | C4DAIP_QUAD_LIGHT_SPECULAR = 111080596 246 | C4DAIP_QUAD_LIGHT_SSS = 1650653106 247 | C4DAIP_QUAD_LIGHT_INDIRECT = 808309255 248 | C4DAIP_QUAD_LIGHT_MAX_BOUNCES = 1497124329 249 | C4DAIP_QUAD_LIGHT_VOLUME_DENSITY = 1225731220 250 | C4DAIP_QUAD_LIGHT_FILTERS = 1172406162 251 | C4DAIP_QUAD_LIGHT_MOTION_START = 939922632 252 | C4DAIP_QUAD_LIGHT_MOTION_END = 894399297 253 | C4DAIP_QUAD_LIGHT_VOLUME_SAMPLES = 808586593 254 | C4DAIP_QUAD_LIGHT_VOLUME = 1614803219 255 | C4DAIP_QUAD_LIGHT_AOV = 1650672837 256 | C4DAIP_QUAD_LIGHT_NAME = 1362822966 257 | 258 | # plugin ids 259 | 260 | ARNOLD_RENDERER = 1029988 261 | ARNOLD_TAG = 1029989 262 | ARNOLD_PARAM_DATATYPE = 1029991 263 | ARNOLD_PARAM_RESOURCETYPE = 1029992 264 | ARNOLD_DRIVER = 1030141 265 | ARNOLD_AOV = 1030369 266 | ARNOLD_TP = 1030371 267 | ARNOLD_CAMERA = 1030423 268 | ARNOLD_LIGHT = 1030424 269 | ARNOLD_SHAPE = 1030425 270 | ARNOLD_SCENE_HOOK = 1032309 271 | ARNOLD_MESH_LIGHT_TAG = 1032418 272 | ARNOLD_PROCEDURAL = 1032509 273 | ARNOLD_VOLUME = 1033693 274 | ARNOLD_SHADER_GV = 1033990 275 | ARNOLD_C4D_SHADER_GV = 1034190 276 | ARNOLD_SHADER_NETWORK = 1033991 277 | ARNOLD_GV_HOOK = 1034003 278 | ARNOLD_GV_CLASS = 1034173 279 | ARNOLD_GV_AISHADER_GROUP = 1034174 280 | ARNOLD_TFD_TAG = 1034388 281 | ARNOLD_XPARTICLES_TAG = 1034537 282 | ARNOLD_SKY = 1034624 283 | ARNOLD_OBJECTMASK_TAG = 1034693 284 | ARNOLD_SUBDIVISION_TAG = 1035157 285 | ARNOLD_REFERENCE_GV = 1035541 286 | ARNOLD_LIGHT_BLOCKER_GEO = 1035772 287 | ARNOLD_DUMMY_BITMAP_SAVER = 1035823 288 | ARNOLD_TX_LOADER = 1035950 289 | ARNOLD_PREFERENCES = 1036062 290 | ARNOLD_MESH_PARTICLES_TAG = 1036721 291 | ARNOLD_CUSTOM_AOV_TAG = 1036856 292 | ARNOLD_VIEWPORT_SHADER = 1037542 293 | ARNOLD_MESSAGE = 1037879 294 | ARNOLD_BACKGROUND_TAG = 1038209 295 | ARNOLD_MESH_VOLUME_TAG = 1039470 296 | ARNOLD_OPERATOR = 1040497 297 | ARNOLD_OPERATOR_GV = 1040805 298 | ARNOLD_VOLUME_OBJECT_TAG = 1041675 299 | ARNOLD_VOLUME_LOADER_TAG = 1041676 300 | ARNOLD_SCATTER = 1055097 301 | ARNOLD_IMAGER_VP = 1055310 302 | ARNOLD_IMAGER = 1055723 303 | ARNOLD_XPEXPLOSIAFX_TAG = 1056644 304 | 305 | # dome 306 | C4DAI_SKYDOME_LIGHT_AOV = 9011 307 | C4DAI_SKYDOME_LIGHT_FLIP = 1814071761 308 | 309 | C4DAI_SKYDOME_COMPATIBILITY = 199999 310 | 311 | C4DAIP_SKYDOME_LIGHT_RESOLUTION = 1173197478 312 | C4DAIP_SKYDOME_LIGHT_FORMAT = 156927185 313 | C4DAIP_SKYDOME_LIGHT_PORTAL_MODE = 576441124 314 | C4DAIP_SKYDOME_LIGHT_MATRIX = 100495259 315 | C4DAIP_SKYDOME_LIGHT_COLOR = 268620635 316 | C4DAIP_SKYDOME_LIGHT_INTENSITY = 310602835 317 | C4DAIP_SKYDOME_LIGHT_EXPOSURE = 100719935 318 | C4DAIP_SKYDOME_LIGHT_CAST_SHADOWS = 624634505 319 | C4DAIP_SKYDOME_LIGHT_CAST_VOLUMETRIC_SHADOWS = 1311663122 320 | C4DAIP_SKYDOME_LIGHT_SHADOW_DENSITY = 652131435 321 | C4DAIP_SKYDOME_LIGHT_SHADOW_COLOR = 749121482 322 | C4DAIP_SKYDOME_LIGHT_SAMPLES = 1828121093 323 | C4DAIP_SKYDOME_LIGHT_NORMALIZE = 1745726313 324 | C4DAIP_SKYDOME_LIGHT_DIFFUSE = 579128428 325 | C4DAIP_SKYDOME_LIGHT_SPECULAR = 1665526885 326 | C4DAIP_SKYDOME_LIGHT_SSS = 966039935 327 | C4DAIP_SKYDOME_LIGHT_INDIRECT = 1932211752 328 | C4DAIP_SKYDOME_LIGHT_MAX_BOUNCES = 1006206950 329 | C4DAIP_SKYDOME_LIGHT_VOLUME_DENSITY = 1056922627 330 | C4DAIP_SKYDOME_LIGHT_FILTERS = 1125301729 331 | C4DAIP_SKYDOME_LIGHT_MOTION_START = 1945476215 332 | C4DAIP_SKYDOME_LIGHT_MOTION_END = 1469293394 333 | C4DAIP_SKYDOME_LIGHT_VOLUME_SAMPLES = 977395186 334 | C4DAIP_SKYDOME_LIGHT_VOLUME = 469032574 335 | C4DAIP_SKYDOME_LIGHT_AOV = 966020204 336 | C4DAIP_SKYDOME_LIGHT_SHADER = 342910877 337 | C4DAIP_SKYDOME_LIGHT_CAMERA = 291124113 338 | C4DAIP_SKYDOME_LIGHT_TRANSMISSION = 405945648 339 | C4DAIP_SKYDOME_LIGHT_AOV_INDIRECT = 1027836509 340 | C4DAIP_SKYDOME_LIGHT_NAME = 1814347399 341 | 342 | C4DAIP_VOLUME_FILENAME = 1869200172 343 | ARNOLD_SCENE_HOOK = 1032309 344 | C4DTOA_MSG_TYPE = 1000 345 | C4DTOA_MSG_GET_VERSION = 1040 346 | C4DTOA_MSG_RESP1 = 2011 347 | C4DTOA_MSG_RESP2 = 2012 348 | C4DTOA_MSG_RESP3 = 2013 349 | 350 | ID_PREFERENCES_NODE = 465001632 # Prefs ID 351 | ID_MATERIAL_MANAGER: int = 12159 352 | 353 | # 自定义aov名称 354 | C4DTOA_AOVTYPES_UTIL: list[str] = [ 355 | 'beauty', 356 | 'AA_inv_density', 357 | 'ID', 358 | 'N', 359 | 'P', 360 | 'Z', 361 | 'Pref', 362 | 'albedo', 363 | 'background', 364 | 'coat', 365 | 'coat_albedo', 366 | 'coat_direct', 367 | 'coat_indirect', 368 | 'cputime', 369 | 'denoise_albedo', 370 | 'denoise_albedo_noisy', 371 | 'diffuse', 372 | 'diffuse_albedo', 373 | 'diffuse_direct', 374 | 'diffuse_indirect', 375 | 'direct', 376 | 'emission', 377 | 'indirect', 378 | 'motionvector', 379 | 'opacity', 380 | 'raycount', 381 | 'shadow_matte', 382 | 'sheen', 383 | 'sheen_albedo', 384 | 'sheen_direct', 385 | 'sheen_indirect', 386 | 'specular', 387 | 'specular_albedo', 388 | 'specular_direct', 389 | 'specular_indirect', 390 | 'sss', 391 | 'sss_albedo', 392 | 'sss_direct', 393 | 'sss_indirect', 394 | 'transmission', 395 | 'transmission_albedo', 396 | 'transmission_direct', 397 | 'transmission_indirect', 398 | 'volume', 399 | 'volume_Z', 400 | 'volume_albedo', 401 | 'volume_direct', 402 | 'volume_indirect', 403 | 'volume_opacity', 404 | 'crypto_asset', 405 | 'crypto_material', 406 | 'crypto_object' 407 | ] 408 | 409 | C4DTOA_AOVTYPES_CRYPOTOMATTE: list[str] = ["cryptomatte","crypto_asset","crypto_material","crypto_object"] 410 | 411 | C4DTOA_AOVTYPES_SHADOW: list[str] = ["shadow_matte","shadow","shadow_diff","shadow_mask"] 412 | 413 | C4DTOA_AOVTYPES_HAIR: list[str] = ["standard_hair","id1","id2","id3","id4","id5","id6","id7","id8"] 414 | 415 | C4DTOA_AOVTYPES_SURFACE: list[str] = ["standard_surface","id1","id2","id3","id4","id5","id6","id7","id8"] 416 | 417 | C4DTOA_AOVTYPES_TOON: list[str] = ["highlight","rim_light"] 418 | 419 | CDTOA_AOVTYPES: list[str] = C4DTOA_AOVTYPES_UTIL + C4DTOA_AOVTYPES_CRYPOTOMATTE + C4DTOA_AOVTYPES_SHADOW + C4DTOA_AOVTYPES_HAIR + C4DTOA_AOVTYPES_SURFACE + C4DTOA_AOVTYPES_TOON 420 | 421 | C4DAIP_PHOTOMETRIC_LIGHT_FILENAME = 1413133543 422 | 423 | C4DAI_LIGHT_COMMON_FILTERS = 100103 -------------------------------------------------------------------------------- /versions/renderEngine/node_helper.md: -------------------------------------------------------------------------------- 1 | # Node Helper 2 | This is a custom api for new NodeGragh in Cinema 4D above R26. 3 | ``` 4 | All the boghma plugins and boghma library is FREE. 5 | ``` 6 | # Limit 7 | - Cinema 4D before R26 is not support. 8 | - AddChild() and AddTextureTree() will return a not auto-layout node network now. 9 | - GetID() is broken, wait Maxon fix it, GetParamDataTypeID() can not get vector id 10 | 11 | ## node_helper (Beta) 12 | - __NodeGraghHelper__ : helper class for Cinema 4D NodeGragh. 13 | - __TexPack__ : helper class to get texture data. 14 | - __methods__ : helper functions. 15 | - __get_all_nodes__ : Get all the nodes in object manager. 16 | - __get_nodes__ : Get all the nodes by given types. 17 | - __get_tags__ : Get all the tags by given types. 18 | - __get_selection_tag__ : Get seclection tag for given texture tag. 19 | - __get_materials__ : Get material for given seclection tag. 20 | - __get_texture_tag__ : Get texture tag for given seclection tag. 21 | - __select_all_materials__ : Select all the materials (with undo). 22 | - __deselect_all_materials__ : Deselect all the materials (with undo). 23 | - __get_asset_url__ : Returns the asset URL for the given file asset ID. 24 | - __get_asset_str__ : Returns the asset str for the given file asset ID. 25 | - __iter_node__ : Provides a non-recursive iterator for all descendants of a node. 26 | - __generate_random_color__ : Generate a random color with factor. 27 | - __get_tex_folder__ : Get tex folder next the the document. (NEW@ v1.0.3) 28 | - __get_texture_path__ : Get texture path in disk. (NEW@ v1.0.3) 29 | - 30 | ### NodeHelper Class/method highlighted: 31 | 32 | - __GetAvailableShaders__ : Get all available nodes of current node space. 33 | - __GetActiveWires__ : Get all selected wires in node editor. 34 | - __GetActivePorts__ : Get all selected ports in node editor. 35 | - __GetActiveNodes__ : Get all selected nodes in node editor. 36 | - __select__ : Select the node. 37 | - __deselect__ : Deselect the node. 38 | - __add_shader__ : Add a shader. 39 | - __remove_shader__ : Remove the given shader. 40 | - __AddConnectShader__ : Add shader and connect with given ports and nodes. 41 | - __AddPort__ : Expose the given Expose on the material. 42 | - __RemovePort__ : Hide the given Expose on the material. 43 | - __GetTrueNode__ : Get the Node of given port. 44 | - __GetPort__ : Get the port of the shader node. 45 | - __GetOutput__ : Get the Output node. 46 | - __GetRootBRDF__ : Get the Root BRDF shader of the output. 47 | - __IsPortValid__ : Get the state of the port. 48 | - __GetParamDataTypeID__ : Get the data type id of given port. 49 | - __GetParamDataType__ : Get the data type of given port. 50 | - __GetShaderValue__ : Get the value of given shader and port. 51 | - __SetShaderValue__ : Set the value of given shader and port. 52 | - __GetName__ : Get the node name. 53 | - __SetName__ : Set the node name. 54 | - __GetAssetId__ : Get the asset id of the given node. 55 | - __GetShaderId__ : Get the shader id of the given node. 56 | - __GetAllConnections__ : Get all the connected wire info. 57 | - __AddConnection__ : Connect two ports on two diffrent nodes. 58 | - __RemoveConnection__ : Remove the connection of the given port on a node. 59 | - __FoldPreview__ : Toggle folding state of the shader previews. 60 | - __GetNodes__ : Get all Nodes of given shader. (NEW@ v0.1.1) 61 | - __CheckPreNode__ : Returns True if the given shader is connected to the pre shader. 62 | - __CheckNextNode__ : Returns True if the given shader is connected to the Next shader. 63 | - ... -------------------------------------------------------------------------------- /versions/renderEngine/octane/Octane.md: -------------------------------------------------------------------------------- 1 | # Octane 2 | This is a custom api for Octane Render in Cinema 4D, which is also wiil contains in 'boghma' library. 3 | ``` 4 | All the boghma plugins and boghma library is FREE. 5 | ``` 6 | ## Installation 7 | To use this library, you have two options: 8 | 1. Download the source and import it to your Cinema 4D 9 | 2. (**Not Ready Now**) You can also download [Boghma Plugin Manager](https://www.boghma.com/) and install any plugin, the boghma lib will auto installed. 10 | 11 | 12 | # Limit 13 | Due to otoy use a custom userarea for the node editor, and don't support python. We can not get the selection of the node edtor, so it is not possible to interact with node editor. 14 | 15 | # Class Presentation 16 | 17 | ## octane_id 18 | #### This Class contains unique ids for octane object, and name map of aovs. 19 | 20 | ## octane_helper 21 | #### This Class contains the functions for the library. And it has some children Classes. 22 | - __Functions(functions)__ 23 | - __VideoPostHelper__ 24 | - __AOVHelper__ 25 | - __MaterialHelper__ 26 | - __SceneHelper__ 27 | 28 | ### octane Class/method highlighted: 29 | #### This Class contains methods for the library. It has the following methods: 30 | 31 | - __GetRenderEngine__ : Return current render engine ID. 32 | - __GetVersion__ : Get the version number of Octane. 33 | - __OpenIPR__ : Open Live Viewer. 34 | - __OpenNodeEditor__ : Open Node Editor for given material. 35 | - __AovManager__ : Open aov Manager. 36 | - __TextureManager__ : Open Octane Texture Manager. 37 | 38 | 39 | ### AOVData: 40 | 41 | #### Octane AOV dataclass structure 42 | 43 | - __aov_shader__: c4d.BaseShader 44 | - __aov_enabled__: bool 45 | - __aov_name__: str 46 | - __aov_type__: c4d.BaseList2D 47 | - __aov_subdata__: list 48 | 49 | ### AOVHelper Class/method highlighted: 50 | 51 | - __get_aov_data__ : Get all aov data in a list of BaseContainer. 52 | - __get_all_aovs__ : Get all octane aovs in a list. 53 | - __get_aov__ : Get all the aovs of given type in a list. 54 | - __print_aov__ : Print main info of existed aov in python console. 55 | - __create_aov_shader__ : Create a shader of octane aov. 56 | - __add_aov__ : Add the octane aov shader to Octane Render. 57 | - __remove_last_aov__ : Remove the last aov shader. 58 | - __remove_empty_aov__ : Romove all the empty aov shaders. 59 | - __remove_all_aov__ : Remove all the aov shaders. 60 | - __remove_aov_type__ : Remove aovs of the given aov type. 61 | - __get_custom_aov__ : Get the custom aov shader of given id. 62 | - __add_custom_aov__ : Add the custom aov shader of given id if it not existed. 63 | - __get_light_aov__ : Get the light aov shader of given id. 64 | - __add_light_aov__ : Add the light aov shader of given id if it not existed. 65 | 66 | ### NodeHelper Class/method highlighted: 67 | 68 | - __GetAllNodes__ : Get all nodes of the material in a list. 69 | - __GetNodes__ : Get all nodes of given type of the material in a list. 70 | - __RefreshTextures__ : Refresh all the Texture shader. 71 | - __ResetCompression__ : Reset all the texture shader compression. 72 | - __AddShader__ : Add a shader to the material of the given type and slot. 73 | - __AddTransform__ : Add a Transform shader to the given slot(option). 74 | - __Addrojection__ : Add a Projection shader to the given slot(option). 75 | - __AddMultiply__ : Add a Multiply shader to the given slot(option). 76 | - __AddSubtract__ : Add a Subtract shader to the given slot(option). 77 | - __AddMathAdd__ : Add a MathAdd shader to the given slot(option). 78 | - __AddMix__ : Add a Mix shader to the given slot(option). 79 | - __AddInvert__ : Add a Invert shader to the given slot(option). 80 | - __AddFloat__ :Add a Float shader to the given slot(option). 81 | - __AddRGB__ : Add a RGB shader to the given slot(option). 82 | - __AddImageTexture__ : Add a ImageTexture shader to the given slot(option). 83 | - __AddCC__ : Add a Color Correction shader to the given slot(option). 84 | - __AddGradient__ : Add a Gradient shader to the given slot(option). 85 | - __AddFalloff__ : Add a Falloff shader to the given slot(option). 86 | - __AddDirt__ : Add a Dirt shader to the given slot(option). 87 | - __AddCurvature__ : Add a Curvature shader to the given slot(option). 88 | - __AddNoise4D__ : Add a Maxon Noise shader to the given slot(option). 89 | - __AddNoise__ : Add a Octane Noise shader to the given slot(option). 90 | - __AddTriplanar__ : Add a Triplanar shader to the given slot(option). 91 | - __AddDisplacement__ : Add a Displacement shader to the given slot(option). 92 | - __AddBlackbodyEmission__ : Add a Blackbody Emission shader to the given slot(option). 93 | - __AddTextureEmission__ : Add a Texture Emission shader to the given slot(option). 94 | - __AddTextureTree__ : Add a Texture + Color Correction + Gradient shader tree to the given slot(option). 95 | 96 | ### MaterialHelper Class/method highlighted: 97 | 98 | - __CreateBasicMaterial__ : Create an Octane Basic(classic) material of given type and name. 99 | - __CreateComposite__ : Create an Octane Composite material of given type and name. 100 | - __CreateStandardMaterial__ : Create an Octane Standard Surface material of given type and name. 101 | - __InsertMaterial__ : Insert the material to the document. 102 | - __Refresh__ : Refresh thumbnail. 103 | - __SetActive__ : Set the material active in the document. 104 | - __SetupTextures__ : Setup a pbr material with given or selected texture. 105 | - __UniTransform__ : Add a Transform node to all the Image nodes. 106 | 107 | ### SceneHelper Class/method highlighted: 108 | 109 | - __add_hdr_dome__ : Add a texture (hdr) dome light to the scene. 110 | - __add_rgb_dome__ : Add a rgb dome light to the scene. 111 | - __add_dome_rig__ : Add a HDR and visible dome light folder. 112 | - __add_light__ : Add an Octane light to the secne. 113 | - __add_light_texture__ : Add textures to given Octane light tag. 114 | - __add_ies__ : Add an Octane ies light to the secne. 115 | - __add_gobo__ : Add an Octane gobo light to the secne. 116 | - __add_sun__ : Add an Octane sun light to the secne. 117 | - __add_light_modifier__ : Add some modify tagsto given Octane light tag. 118 | - __add_object_tag__ : Add an object tag to the given object. 119 | - __add_objects_tag__ : Add object tags to the given objects(enumerate id). 120 | - __add_custom_aov_tag__ : Add an object tag of given custom aov id to the given object. 121 | - __add_camera_tag__ : Add an camera tag to the given camera. 122 | - __set_tag_texture__ : Set Texture path of given tag and slot. (NEW@ v1.0.3) 123 | - __set_tag_color__ : Set color of given tag and slot. (NEW@ v1.0.3) 124 | - __get_tag__ : Get tag of given object. (NEW@ v1.0.3) 125 | - __add_scatter__ : Add a scatter object of given generator_node and scatter_nodes. 126 | - __add_vdb__ : Add a vdb loader object with the given path to the scene. 127 | 128 | # Eaxmple 129 | 1. __VideoPostHelper__ : Get the renderer id and version, set the render settings. 130 | 2. __AOVHelper__ : Add/Remove/Set/Get aovs, and print aov info. 131 | 3. __MaterialHelper__ : Create an Octane material with nodes and print shader info. 132 | 4. __SceneHelper__ : Create lights/tags/objects. 133 | 134 | 135 | 136 | -------------------------------------------------------------------------------- /versions/renderEngine/octane/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DunHouGo/renderEngine/44ca8f927b6594f294ed0c5061c26ca781dd02e7/versions/renderEngine/octane/__init__.py -------------------------------------------------------------------------------- /versions/renderEngine/octane/octane_examples.py: -------------------------------------------------------------------------------- 1 | # Octane 2 | 3 | ### ========== Import Libs ========== ### 4 | from typing import Optional 5 | import c4d,maxon 6 | from importlib import reload 7 | from renderEngine.octane import octane_helper as oc 8 | reload(oc) 9 | from pprint import pprint 10 | try: 11 | from octane_id import * 12 | except: 13 | from renderEngine.octane.octane_id import * 14 | from renderEngine import node_helper 15 | reload(node_helper) 16 | tex_helper = node_helper.TextureHelper() 17 | ### ========== Author INFO ========== ### 18 | 19 | __author__ = "DunHouGo" 20 | __copyright__ = "Copyright (C) 2023 Boghma" 21 | __website__ = "https://www.boghma.com/" 22 | __license__ = "Apache-2.0 License" 23 | __version__ = "2023.2.1" 24 | 25 | 26 | ### ========== VideoPost ========== ### 27 | 28 | doc: c4d.documents.BaseDocument # The active document 29 | op: Optional[c4d.BaseObject] # The active object, None if unselected 30 | render_path: str = r'Render/example/test.png' 31 | 32 | #--------------------------------------------------------- 33 | # Example 01 34 | # VideoPostHelper 35 | #--------------------------------------------------------- 36 | def example_01_videopost(): 37 | # Get the RenderEngine id. 38 | print(f'Current render engine ID : {oc.GetRenderEngine(doc)}.') 39 | # Get the current render version. 40 | print(f'Current render engine version : {oc.GetVersion()}.') 41 | # Set the VideoPostHelper instance 42 | videopost_helper = oc.VideoPostHelper(doc) 43 | # Set render setting 44 | videopost_helper.set_render_settings(file_path = render_path, use_exr = True, no_filters = False) 45 | print('We set octane render with custom (path/format/zip/filter)') 46 | 47 | #--------------------------------------------------------- 48 | # Example 02 49 | # AOVHelper 50 | #--------------------------------------------------------- 51 | def example_02_aovs(): 52 | # Get Octane videopost 53 | videopost: c4d.documents.BaseVideoPost = oc.VideoPostHelper(doc).videopost 54 | # Set Octane AOVHelper instance 55 | aov_helper = oc.AOVHelper(videopost) 56 | 57 | # Create a Octane aov item id can find from octane_id.py 58 | # If #name is None, defulat to type. 59 | diff_aov = aov_helper.create_aov_shader(aov_type = RNDAOV_DIFFUSE) 60 | # Add the DIFFUSE aov just created to the Octane aov system 61 | aov_helper.add_aov(diff_aov) 62 | 63 | # Add some aovs 64 | aov_helper.add_aov(aov_helper.create_aov_shader(aov_type = RNDAOV_POST,aov_name = 'POST')) 65 | aov_helper.add_aov(aov_helper.create_aov_shader(RNDAOV_DIF_D)) 66 | aov_helper.add_aov(aov_helper.create_aov_shader(RNDAOV_DIF_I)) 67 | aov_helper.add_aov(aov_helper.create_aov_shader(RNDAOV_REFL_D)) 68 | aov_helper.add_aov(aov_helper.create_aov_shader(RNDAOV_REFL_I)) 69 | aov_helper.add_aov(aov_helper.create_aov_shader(RNDAOV_WIRE)) 70 | aov_helper.add_aov(aov_helper.create_aov_shader(RNDAOV_OBJECT_LAYER_COLOR)) 71 | aov_helper.add_aov(aov_helper.create_aov_shader(RNDAOV_VOLUME)) 72 | 73 | # Remove last aov: volume 74 | aov_helper.remove_last_aov() 75 | 76 | # Remove specified aov: wire 77 | aov_helper.remove_aov_type(aov_type = RNDAOV_WIRE) 78 | 79 | # Add 2 custom aovs with id 1 and 2 80 | aov_helper.add_custom_aov(customID = 1) 81 | aov_helper.add_custom_aov(customID = 2) 82 | 83 | # Get the custom aov with id 2 84 | custom2 = aov_helper.get_custom_aov(customID = 2) 85 | if custom2: 86 | print(f'We find a Custom AOV with id 2 Named{custom2.GetName()}') 87 | 88 | # Print current aov info 89 | aov_helper.print_aov() 90 | 91 | #--------------------------------------------------------- 92 | # Example 03 A 93 | # MaterialHelper 94 | #--------------------------------------------------------- 95 | def example_03_materials_A(): 96 | # Set Octane MaterialHelper instance 97 | MyMaterial = oc.MaterialHelper(doc) 98 | # Create a univeral material named 'MyMaterial' 99 | MyMaterial.CreateBasicMaterial(isMetal=False, matType=MAT_TYPE_UNIVERSAL, matName = "MyMaterial") 100 | # Add a float texture to roughness port 101 | MyMaterial.AddFloat(parentNode = c4d.OCT_MATERIAL_ROUGHNESS_LINK) 102 | # Add a node tree to Albedo port, and set path and props 103 | url: maxon.Url = tex_helper.GetAssetStr("file_ed38c13fd1ae85ae") 104 | MyMaterial.AddTextureTree(texturePath = url, nodeName = 'Albedo', isFloat = False, gamma = 2.2, 105 | invert = False, parentNode = c4d.OCT_MATERIAL_DIFFUSE_LINK) 106 | # Insert the material 107 | MyMaterial.InsertMaterial() 108 | # Set the material active 109 | MyMaterial.SetActive() 110 | # Open the Node Editor 111 | oc.OpenNodeEditor() 112 | # Get all shader in the material 113 | node_list = MyMaterial.GetAllNodes() 114 | # Print the info 115 | print(f'We create an Octane Material with name {MyMaterial.material.GetName()}') 116 | print('#-----Shader-----#') 117 | pprint(node_list) 118 | print('#----- End -----#') 119 | 120 | #--------------------------------------------------------- 121 | # Example 03 B 122 | # MaterialHelper 123 | #--------------------------------------------------------- 124 | def example_03_materials_B(): 125 | # Set Octane MaterialHelper instance 126 | MyMaterial = oc.MaterialHelper(doc) 127 | # Create a univeral material named 'MyMaterial' 128 | MyMaterial.CreateBasicMaterial(isMetal=False, matType=MAT_TYPE_UNIVERSAL, matName = "MyMaterial") 129 | # Setup a pbr material with given or selected texture. 130 | # We select a albedo texture of Megascans texture package here 131 | # But you can select almost any texture package here 132 | texpack = node_helper.TextureHelper() 133 | 134 | # 用户任意选择一张贴图, 最好不要选择albedo,而是选择Normal这种 135 | texture = c4d.storage.LoadDialog(type=c4d.FILESELECTTYPE_IMAGES, title='Select a texture',flags=c4d.FILESELECT_LOAD) 136 | if texture: 137 | texture_data = texpack.PBRFromTexture(texture) 138 | tex_data = texture_data[0] 139 | mat_name = texture_data[1] 140 | 141 | MyMaterial.SetupTextures(tex_data,mat_name) 142 | # Add a Transform node to all the Image nodes. 143 | MyMaterial.UniTransform() 144 | # Insert the material 145 | MyMaterial.InsertMaterial() 146 | # Set the material active 147 | MyMaterial.SetActive() 148 | # Open the Node Editor 149 | oc.OpenNodeEditor() 150 | # Get all shader in the material 151 | node_list = MyMaterial.GetAllNodes() 152 | # Print the info 153 | print(f'We create an Octane PBR Material with name {MyMaterial.material.GetName()}') 154 | print('#-----Shader-----#') 155 | pprint(node_list) 156 | print('#----- End -----#') 157 | 158 | #--------------------------------------------------------- 159 | # Example 04 160 | # SceneHelper 161 | #--------------------------------------------------------- 162 | def example_04_scenes(): 163 | # Set Octane SceneHelper instance 164 | scene_helper = oc.SceneHelper(doc) 165 | 166 | ### == Light == ### 167 | # Add a rig of hdr and rgb backdrop 168 | hdr_url: maxon.Url = tex_helper.GetAssetStr("file_d21cf4cfdec8c636") 169 | scene_helper.add_dome_rig(texture_path = hdr_url, rgb = c4d.Vector(0,0,0)) 170 | # Add a light object and and some modify tags 171 | gobo_url: maxon.Url = tex_helper.GetAssetStr("file_66b116a34a150e7e") 172 | mylight = scene_helper.add_light(power = 5, light_name = 'My Light', texture_path = gobo_url, distribution_path = None, visibility= False) 173 | scene_helper.add_light_modifier(light = mylight, target = True, gsg_link = True, rand_color = True) 174 | 175 | ### == Tag == ### 176 | # Add a Cude object and an Octane tag with layerID 2 177 | cube = c4d.BaseObject(c4d.Ocube) 178 | scene_helper.add_object_tag(node=cube, layerID=2) 179 | doc.InsertObject(cube) 180 | # Add a Sphere object and an Octane tag with custom aov id 2 181 | sphere = c4d.BaseObject(c4d.Osphere) 182 | scene_helper.add_custom_aov_tag(node=sphere, aovID=2) 183 | doc.InsertObject(sphere) 184 | # Add a Camera object and an Octane cam tag, then copy render setting data to it 185 | cam = c4d.BaseObject(c4d.Ocamera) 186 | doc.InsertObject(cam) 187 | camtag = scene_helper.add_camera_tag(node=cam) 188 | videopost_helper = oc.VideoPostHelper(doc) 189 | videopost_helper.videopost_to_camera(camtag) 190 | 191 | ### == Object == ### 192 | # Add a scatter obejct with some children and count 12345 193 | generate_object = c4d.BaseObject(c4d.Oplane) 194 | doc.InsertObject(generate_object) 195 | scatter_A = c4d.BaseObject(c4d.Oplatonic) 196 | scatter_B = c4d.BaseObject(c4d.Ooiltank) 197 | doc.InsertObject(scatter_A) 198 | doc.InsertObject(scatter_B) 199 | scatters: list[c4d.BaseObject] = [scatter_A, scatter_B] 200 | scene_helper.add_scatter(generator_node=generate_object, scatter_nodes=scatters, count=12345) 201 | 202 | if __name__ == '__main__': 203 | # --- 1 --- # 204 | example_01_videopost() 205 | # --- 2 --- # 206 | example_02_aovs() 207 | # --- 3 --- # 208 | example_03_materials_A() 209 | example_03_materials_B() 210 | # --- 4 --- # 211 | example_04_scenes() 212 | 213 | # Put Refresh 214 | c4d.EventAdd() -------------------------------------------------------------------------------- /versions/renderEngine/octane/octane_id.py: -------------------------------------------------------------------------------- 1 | import c4d 2 | 3 | 4 | DiffuseName = "Diffuse" 5 | GlossyName = "Glossy" 6 | SpecularName = "Specular" 7 | UniversalName = "Universal" 8 | MetallicName = "Metallic" 9 | ToonName = "Toon" 10 | 11 | SUBMaterialNodeID = 1040369 12 | 13 | 14 | SET_RENDERAOV_IN_CNT=3700 15 | SET_RENDERAOV_INPUT_0=3740 16 | 17 | ID_OCTANE_VIDEO_POST = 1029525 # octane render 18 | ID_OCTANE_RENDERPASS_AOV = 1057006 # pass 19 | VP_BUFFER_TYPE = 1010 20 | VP_COLOR_SPACE = 1028 21 | # RenderPassAOV_h 22 | RNDAOV_NAME=900 23 | RNDAOV_ENABLED=994 24 | RNDAOV_TYPE=995 25 | RNDAOV_TYPE_NAME=1101 26 | 27 | RNDAOV_DIFFUSE=188 28 | RNDAOV_DIF_FILTER=191 29 | RNDAOV_REFLECTION=222 30 | RNDAOV_REFL_FILTER=225 31 | RNDAOV_REFRACT_FILTER=230 32 | RNDAOV_TRANSM_FILTER=242 33 | RNDAOV_TEX_TANGENT=240 34 | RNDAOV_UVSET=3459 35 | RNDAOV_CRYPTOMATTE=185 36 | 37 | RNDAOV_EMIT=196 38 | RNDAOV_ENV=197 39 | RNDAOV_DIF_D=189 40 | RNDAOV_DIF_I=193 41 | RNDAOV_REFL_D=223 42 | RNDAOV_REFL_I=227 43 | RNDAOV_REFRACT=229 44 | RNDAOV_TRANS=244 45 | RNDAOV_SSS=238 46 | RNDAOV_POST=221 47 | RNDAOV_NOISE=212 48 | RNDAOV_SHADOW=237 49 | RNDAOV_LAYER_BLACKSHD=202 50 | RNDAOV_LAYER_COLORSHD=204 51 | RNDAOV_LAYER_REFLECTION=203 52 | 53 | RNDAOV_POST_INCLUDE_ENV=3325 54 | RNDAOV_IRRADIANCE=201 55 | RNDAOV_LIGHT_DIRECTION=207 56 | RNDAOV_VOLUME=246 57 | RNDAOV_VOLUME_MASK=250 58 | RNDAOV_VOLUME_EMISSION=248 59 | RNDAOV_VOLUME_Z_DEPTH_FRONT=251 60 | RNDAOV_VOLUME_Z_DEPTH_BACK=252 61 | RNDAOV_CUSTOM=186 62 | RNDAOV_GLOBALTEX=199 63 | RNDAOV_CUSTOM_IDS=3390 64 | RNDAOV_VISIBLE_AFTER=3391 65 | RNDAOV_ZDEPTH_MAX=3392 66 | RNDAOV_ZDEPTH_ENVDEPTH=3397 67 | RNDAOV_UVMAX=3393 68 | RNDAOV_MAXSPEED=3394 69 | RNDAOV_AODIST=3395 70 | RNDAOV_AOALPHASHD=3396 71 | RNDAOV_WIRE_SHADING=3398 72 | RNDAOV_WIRE_BMPNRML_MAP=3399 73 | RNDAOV_WIRE_HGLTBACK=3400 74 | 75 | RNDAOV_GEONORM=198 76 | RNDAOV_SHDNORM=236 77 | RNDAOV_SMOOTHNORM=253 78 | RNDAOV_POSITION=220 79 | RNDAOV_ZDEPTH=255 80 | RNDAOV_MATID=210 81 | RNDAOV_UV_COORD=245 82 | RNDAOV_TANGENT=239 83 | RNDAOV_WIRE=254 84 | RNDAOV_OBJECT_ID=217 85 | RNDAOV_AO=183 86 | RNDAOV_MOTION_VECTOR=211 87 | RNDAOV_RENDER_LAYER_ID=233 88 | RNDAOV_RENDER_LAYER_MASK=234 89 | RNDAOV_FSIZE=3347 90 | RNDAOV_LIGHT_PASS_ID=209 91 | RNDAOV_OBJECT_LAYER_COLOR=218 92 | RNDAOV_BAKEGROUP_ID=184 93 | RNDAOV_SMOOTHNORM_N=3442 94 | RNDAOV_TANGENT_N=3446 95 | RNDAOV_GEONORM_N=3440 96 | RNDAOV_SHDNORM_N=3441 97 | RNDAOV_POSITION_N=3443 98 | RNDAOV_ZDEPTH_N=3444 99 | RNDAOV_UV_COORD_N=3445 100 | RNDAOV_MOT_VECTOR_N=3447 101 | RNDAOV_TEX_TANGENT_N=3448 102 | 103 | RNDAOV_DISTR_PT=3350 104 | RNDAOV_DIST_TRACING=3351 105 | RNDAOV_BEAUTY_DENOISER=3380 106 | RNDAOV_DENOISER_DIFFUSE_D=190 107 | RNDAOV_DENOISER_DIFFUSE_I=194 108 | RNDAOV_DENOISER_REFLECT_D=224 109 | RNDAOV_DENOISER_REFLECT_I=228 110 | RNDAOV_DENOISER_REFRACTION=3385 111 | RNDAOV_DENOISER_REMAINDER=232 112 | RNDAOV_DENOISER_EMISSION=195 113 | RNDAOV_DENOISER_VOLUME=247 114 | RNDAOV_DENOISER_VOL_EMIS=249 115 | 116 | RNDAOV_INFO_OPACITY=219 117 | RNDAOV_INFO_ROUGHNESS=235 118 | RNDAOV_INFO_DIFFUSE=192 119 | RNDAOV_INFO_REFLECTION=3364 120 | RNDAOV_INFO_REFL_FILTER=226 121 | RNDAOV_INFO_REFRACTION=3365 122 | RNDAOV_INFO_REFRACT_FILTER=231 123 | RNDAOV_INFO_IOR=200 124 | RNDAOV_INFO_TRANSMISSON=243 125 | RNDAOV_RAW=3450 126 | RNDAOV_LIGHT=205 127 | RNDAOV_LIGHT_D=206 128 | RNDAOV_LIGHT_I=208 129 | RNDAOV_CRYPTO_TYPE=1821 130 | RNDAOV_LIGHT_ID=1822 131 | 132 | ID_OCTANE_BASE_MATERIAL = 1029501 133 | ID_OCTANE_STANDARD_SURFACE = 1058763 134 | ID_OCTANE_COMPOSITE_MATERIAL = 1040075 135 | ID_OCTANE_MIX_MATERIAL = 1029622 136 | ID_OCTANE_PORTAL_MATERIAL = 1029623 137 | ID_OCTANE_CLIPPING_MATERIAL = 1056989 138 | ID_OCTANE_SHADOWCATCHER_MAT = 1057003 139 | ID_OCTANE_HAIR_MATERIAL = 1054119 140 | OCTANE_MATERIALS = [ID_OCTANE_BASE_MATERIAL, 141 | ID_OCTANE_STANDARD_SURFACE, 142 | ID_OCTANE_MIX_MATERIAL, 143 | ID_OCTANE_PORTAL_MATERIAL, 144 | ID_OCTANE_CLIPPING_MATERIAL, 145 | ID_OCTANE_SHADOWCATCHER_MAT, 146 | ID_OCTANE_HAIR_MATERIAL, 147 | ID_OCTANE_COMPOSITE_MATERIAL 148 | ] 149 | 150 | 151 | MAT_TYPE_DIFFUSE = 2510 152 | MAT_TYPE_GLOSSY = 2511 153 | MAT_TYPE_SPECULAT = 2513 154 | MAT_TYPE_METALLIC = 2514 155 | MAT_TYPE_TOON = 2515 156 | MAT_TYPE_UNIVERSAL = 2516 157 | 158 | BRDF_OCTANE = 0 159 | BRDF_GGX = 2 160 | BRDF_GGX_EP = 6 161 | 162 | # Node IDs for Octane nodes 163 | ID_OCTANE_FLOAT_TEXTURE = 1029506 164 | ID_OCTANE_IMAGE_TEXTURE = 1029508 165 | ID_OCTANE_RGBSPECTRUM = 1029504 166 | 167 | ID_OCTANE_MULTIPLY_TEXTURE = 1029516 168 | ID_OCTANE_SUBTRACT_TEXTURE = 1038878 169 | ID_OCTANE_INVERT_TEXTURE = 1029514 170 | ID_OCTANE_ADD_TEXTURE = 1038877 171 | ID_OCTANE_MIXTEXTURE = 1029505 172 | 173 | ID_OCTANE_COLORCORRECTION = 1029512 174 | ID_OCTANE_GRADIENT_TEXTURE = 1029513 175 | ID_OCTANE_CLAMP_TEXTURE = 1029511 176 | ID_INSTANCE_RANGE_TEXTURE = 1039376 177 | ID_OCTANE_FALLOFFMAP = 1029503 178 | ID_OCTANE_DIRT_TEXTURE = 1029975 179 | ID_OCTANE_CURVATURE_TEX = 1057004 180 | ID_OCTANE_C4DNOISE_TEX = 1058853 181 | ID_OCTANE_NOISE_TEXTURE = 1033698 182 | 183 | ID_OCTANE_TRIPLANAR = 1038882 184 | ID_OCTANE_TRANSFORM = 1030961 185 | ID_OCTANE_DISPLACEMENT = 1031901 186 | ID_OCTANE_TEXTURE_PROJECTION = 1031460 187 | ID_OCTANE_BLACKBODY_EMISSION = 1029641 188 | ID_OCTANE_TEXTURE_EMISSION = 1029642 189 | 190 | ID_OCTANE_LIVEPLUGIN = 1029499 # Octane Live Viewer 191 | ID_OCTANE_CAMERATAG = 1029524 # Octane Camera Tag 192 | ID_OCTANE_ENVIRONMENT_TAG = 1029643 193 | ID_OCTANE_OBJECTTAG = 1029603 194 | ID_OCTANE_LIGHT_TAG = 1029526 195 | 196 | ID_VOLUMEOBJECT = 1035792 197 | ID_SCATTER_OBJECT = 1035961 198 | ID_OCTANE_DAYLIGHT_TAG = 1029754 199 | 200 | AOV_SYMBOLS: dict[int, str] = { 201 | RNDAOV_AO: 'Ao', 202 | RNDAOV_AOALPHASHD: 'Ao alpha shadow', 203 | RNDAOV_AODIST: 'Aodist', 204 | RNDAOV_BAKEGROUP_ID: 'Bakegroup Id', 205 | RNDAOV_BEAUTY_DENOISER: 'Beauty Denoiser', 206 | RNDAOV_CRYPTOMATTE: 'Cryptomatte', 207 | RNDAOV_CUSTOM: 'Custom', 208 | RNDAOV_CUSTOM_IDS: 'Custom Ids', 209 | RNDAOV_DENOISER_DIFFUSE_D: 'Denoiser diffuse direct', 210 | RNDAOV_DENOISER_DIFFUSE_I: 'Denoiser Diffuse indirect', 211 | RNDAOV_DENOISER_EMISSION: 'Denoiser Emission', 212 | RNDAOV_DENOISER_REFLECT_D: 'Denoiser Reflect direct', 213 | RNDAOV_DENOISER_REFLECT_I: 'Denoiser Reflect indirect', 214 | RNDAOV_DENOISER_REFRACTION: 'Denoiser Refraction', 215 | RNDAOV_DENOISER_REMAINDER: 'Denoiser Remainder', 216 | RNDAOV_DENOISER_VOLUME: 'Denoiser Volume', 217 | RNDAOV_DENOISER_VOL_EMIS: 'Denoiser Vol Emission', 218 | RNDAOV_DIFFUSE: 'Diffuse', 219 | RNDAOV_DIF_D: 'Diffuse direct', 220 | RNDAOV_DIF_FILTER: 'Diffuse Filter', 221 | RNDAOV_DIF_I: 'Diffuse indirect', 222 | RNDAOV_DISTR_PT: 'Distr Pt', 223 | RNDAOV_DIST_TRACING: 'Dist Tracing', 224 | RNDAOV_EMIT: 'Emit', 225 | RNDAOV_ENV: 'Env', 226 | RNDAOV_FSIZE: 'Fsize', 227 | RNDAOV_GEONORM: 'Geo normal', 228 | RNDAOV_GEONORM_N: 'Geonorm N', 229 | RNDAOV_GLOBALTEX: 'Globaltex', 230 | RNDAOV_INFO_DIFFUSE: 'Info Diffuse', 231 | RNDAOV_INFO_IOR: 'Info Ior', 232 | RNDAOV_INFO_OPACITY: 'Info Opacity', 233 | RNDAOV_INFO_REFLECTION: 'Info Reflection', 234 | RNDAOV_INFO_REFL_FILTER: 'Info Refl Filter', 235 | RNDAOV_INFO_REFRACTION: 'Info Refraction', 236 | RNDAOV_INFO_REFRACT_FILTER: 'Info Refract Filter', 237 | RNDAOV_INFO_ROUGHNESS: 'Info Roughness', 238 | RNDAOV_INFO_TRANSMISSON: 'Info Transmisson', 239 | RNDAOV_IRRADIANCE: 'Irradiance', 240 | RNDAOV_LAYER_BLACKSHD: 'Layer Blackshd', 241 | RNDAOV_LAYER_COLORSHD: 'Layer Colorshd', 242 | RNDAOV_LAYER_REFLECTION: 'Layer Reflection', 243 | RNDAOV_LIGHT: 'Light', 244 | RNDAOV_LIGHT_D: 'Light direct', 245 | RNDAOV_LIGHT_DIRECTION: 'Light Direction', 246 | RNDAOV_LIGHT_I: 'Light indirect', 247 | RNDAOV_LIGHT_PASS_ID: 'Light Pass Id', 248 | RNDAOV_MATID: 'Material id', 249 | RNDAOV_MAXSPEED: 'Maxspeed', 250 | RNDAOV_MOTION_VECTOR: 'Motion Vector', 251 | RNDAOV_MOT_VECTOR_N: 'Mot Vector N', 252 | RNDAOV_NOISE: 'Noise', 253 | RNDAOV_OBJECT_ID: 'Object Id', 254 | RNDAOV_OBJECT_LAYER_COLOR: 'Object Layer Color', 255 | RNDAOV_POSITION: 'Position', 256 | RNDAOV_POSITION_N: 'Position N', 257 | RNDAOV_POST: 'Post', 258 | RNDAOV_POST_INCLUDE_ENV: 'Post Include Env', 259 | RNDAOV_RAW: 'Raw', 260 | RNDAOV_REFLECTION: 'Reflection', 261 | RNDAOV_REFL_D: 'Refl direct', 262 | RNDAOV_REFL_FILTER: 'Refl Filter', 263 | RNDAOV_REFL_I: 'Refl indirect', 264 | RNDAOV_REFRACT: 'Refract', 265 | RNDAOV_REFRACT_FILTER: 'Refract Filter', 266 | RNDAOV_RENDER_LAYER_ID: 'Render Layer Id', 267 | RNDAOV_RENDER_LAYER_MASK: 'Render Layer Mask', 268 | RNDAOV_SHADOW: 'Shadow', 269 | RNDAOV_SHDNORM: 'Shdnorm', 270 | RNDAOV_SHDNORM_N: 'Shdnorm N', 271 | RNDAOV_SMOOTHNORM: 'Smoothnorm', 272 | RNDAOV_SMOOTHNORM_N: 'Smoothnorm N', 273 | RNDAOV_SSS: 'SSS', 274 | RNDAOV_TANGENT: 'Tangent', 275 | RNDAOV_TANGENT_N: 'Tangent N', 276 | RNDAOV_TEX_TANGENT: 'Tex Tangent', 277 | RNDAOV_TEX_TANGENT_N: 'Tex Tangent N', 278 | RNDAOV_TRANS: 'Trans', 279 | RNDAOV_TRANSM_FILTER: 'Transm Filter', 280 | RNDAOV_UVMAX: 'Uvmax', 281 | RNDAOV_UVSET: 'Uvset', 282 | RNDAOV_UV_COORD: 'Uv Coord', 283 | RNDAOV_UV_COORD_N: 'Uv Coord N', 284 | RNDAOV_VISIBLE_AFTER: 'Visible After', 285 | RNDAOV_VOLUME: 'Volume', 286 | RNDAOV_VOLUME_EMISSION: 'Volume Emission', 287 | RNDAOV_VOLUME_MASK: 'Volume Mask', 288 | RNDAOV_VOLUME_Z_DEPTH_BACK: 'Volume Z Depth Back', 289 | RNDAOV_VOLUME_Z_DEPTH_FRONT: 'Volume Z Depth Front', 290 | RNDAOV_WIRE: 'Wire', 291 | RNDAOV_WIRE_BMPNRML_MAP: 'Wire Bmpnrml Map', 292 | RNDAOV_WIRE_HGLTBACK: 'Wire Hgltback', 293 | RNDAOV_WIRE_SHADING: 'Wire Shading', 294 | RNDAOV_ZDEPTH: 'Zdepth', 295 | RNDAOV_ZDEPTH_ENVDEPTH: 'Zdepth Envdepth', 296 | RNDAOV_ZDEPTH_MAX: 'Zdepth Max', 297 | RNDAOV_ZDEPTH_N: 'Zdepth Normal' 298 | } 299 | 300 | CAMERA_TYPE = 1439 301 | CAM_TYPE_UNIVERSIAL = 5 302 | CAM_UNIVERSIAL_APERTURESHAPE = 1515 303 | CAM_APERTURE_CUSTOM = 4 304 | CAM_APERTURE_TEXTURE = 1507 -------------------------------------------------------------------------------- /versions/renderEngine/redshift/Redshift.md: -------------------------------------------------------------------------------- 1 | # Redshift 2 | This is a custom api for Redshift Render in Cinema 4D, which is also wiil contains in 'boghma' library. This is a free lib for our boghma plugins with c4d. 3 | 4 | To use this library, you need to download the source or download Boghma Plugin Manager and install the latest version. Downlad from: https://www.boghma.com (not done yet) and install any plugin, the boghma lib will auto installed. 5 | 6 | # Limit 7 | - AddChild() and AddTextureTree() will return a not auto-layout node network now. 8 | - GetID() is broken, wait Maxon fix it, GetParamDataTypeID() can not get vector id 9 | 10 | # Class Presentation 11 | 12 | ## Redshift_id 13 | #### This Class contains unique ids for Redshift object, and name map of aovs. 14 | 15 | ## Redshift_helper 16 | #### This Class contains the functions for the library. And it has some children Classes. 17 | - __Functions(functions)__ 18 | - __VideoPostHelper__ 19 | - __RedshiftAOVData__ 20 | - __AOVHelper__ 21 | - __MaterialHelper__ 22 | - __RSMaterialTransaction__ 23 | - __SceneHelper__ 24 | 25 | ### Redshift Class/method highlighted: 26 | #### This Class contains methods for the library. It has the following methods: 27 | - __GetRedshiftPreference__ : Get the Redshift preference. 28 | - __RedshiftNodeBased__ : Check if in Redshift and use node material mode. 29 | - __SetMaterialPreview__ : Set material preview mode, default to 'when render is idle'. 30 | - __GetRenderEngine__ : Return current render engine ID. 31 | - __GetVersion__ : Get the version number of Redshift. 32 | - __OpenIPR__ : Open Render View. 33 | - __OpenNodeEditor__ : Open Node Editor for given material. 34 | - __AovManager__ : Open aov Manager. 35 | - __TextureManager__ : Open Redshift Texture Manager. 36 | - __RedshiftNodeBased__ : Check if in Redshift and use node material mode. 37 | 38 | 39 | ### AOVData: 40 | 41 | #### Redshift AOV dataclass structure 42 | 43 | - __aov_shader__: c4d.BaseShader 44 | - __aov_enabled__: bool 45 | - __aov_name__: str 46 | - __aov_type__: c4d.BaseList2D 47 | - __aov_muti_enabled__: bool 48 | - __aov_bit_depth__: int 49 | - __aov_dir_output__: bool 50 | - __aov_dir_outpath__: str 51 | - __aov_subdata__: any 52 | - __light_group_data__: any 53 | 54 | 55 | ### AOVHelper Class/method highlighted: 56 | - __get_type_name__ : Get the name string of given aov type. 57 | - __get_name__ : Get the name of given aov. 58 | - __set_name__ : Set the name of given aov. 59 | - __get_all_aovs__ : Get all Redshift aovs in a list. 60 | - __get_aovs__ : Get all the aovs of given type in a list. 61 | - __get_aov__ : Get the aov of given type. 62 | - __read_aov__ : Get aov data in a list of AOVData Class. 63 | - __print_aov__ : Print main info of existed aov in python console. 64 | - __create_aov_shader__ : Create a shader of Redshift aov. 65 | - __set_aov__ : Set the Redshift aov (**call before add aovs**). 66 | - __add_aov__ : Add the Redshift aov shader to Redshift Render. 67 | - __remove_last_aov__ : Remove the last aov shader. 68 | - __update_aov__ : Update atribute of given aov. 69 | - __remove_all_aov__ : Remove all the aov shaders. 70 | - __remove_aov_type__ : Remove aovs of the given aov type. 71 | - __set_light_group__ : Set a light group to given aov. 72 | - __active_light_group__ : Active a light group to given aov. 73 | - __set_puzzle_matte__ : Add a white aov shader of given id. 74 | 75 | 76 | ### MaterialHelper Class/method highlighted: 77 | 78 | - __Create__ : Create an Redshift Basic(classic) material of given name. 79 | - __CreateStandardSurface__ : Create an Redshift Standard Surface material of given name. 80 | - __CreateRSMaterial__ : Creates a new Redshift Material with a NAME. 81 | - __ExposeUsefulPorts__ : Expose some useful port on material. 82 | - __InsertMaterial__ : Insert the material to the document. 83 | - __Refresh__ : Refresh thumbnail. 84 | - __SetActive__ : Set the material active in the document. 85 | - __SetupTextures__ : Setup a pbr material with given or selected texture. 86 | - __FastPreview__ : Set material preview to 64x64 or default. 87 | 88 | - __AddShader__ : Add a shader to the material of the given type and slot. 89 | 90 | - __AddStandardMaterial__ : Adds a new Standard Material shader to the graph. 91 | - __AddRSMaterial__ : Adds a new RSMaterial shader to the graph. 92 | - __AddMaterialBlender__ : Adds a new Material Blender shader to the graph. 93 | - __AddMaterialLayer__ : Adds a new Material Layer shader to the graph. 94 | - __AddIncandescent__ : Adds a new Incandescent Material shader to the graph. 95 | - __AddSprite__ : Adds a new Sprite Material shader to the graph. 96 | 97 | - __AddColorConstant__ : Adds a new Color Constant shader to the graph. 98 | - __AddColorSplitter__ : Adds a new Color Splitter shader to the graph. 99 | - __AddColorComposite__ : Adds a new Color Composite shader to the graph. 100 | - __AddColorLayer__ : Adds a new Color Layer shader to the graph. 101 | - __AddColorChangeRange__ : Adds a new Color Change Range shader to the graph. 102 | - __AddColorCorrect__ : Adds a new color correct shader to the graph. 103 | 104 | - __AddMathMix__ : Adds a new Math Mix shader to the graph. 105 | - __AddVectorMix__ : Adds a new Vector Mix shader to the graph. 106 | - __AddColorMix__ : Adds a new Color Mix shader to the graph. 107 | - __AddMathAdd__ : Adds a new Math Add shader to the graph. 108 | - __AddVectorAdd__ : Adds a new Vector Add shader to the graph. 109 | - __AddMathSub__ : Adds a new Math Sub shader to the graph. 110 | - __AddVectorSub__ : Adds a new Vector Sub shader to the graph. 111 | - __AddColorSub__ : Adds a new Color Sub shader to the graph. 112 | - __AddMathMul__ : Adds a new Math Mul shader to the graph. 113 | - __AddVectorMul__ : Adds a new Vector Mul shader to the graph. 114 | - __AddMathDiv__ : Adds a new Math Div shader to the graph. 115 | - __AddVectorDiv__ : Adds a new Vector Div shader to the graph. 116 | 117 | 118 | - __AddBump__ : Adds a new Bump shader to the graph. 119 | - __AddBumpBlender__ : Adds a new bump blender shader to the graph. 120 | - __AddDisplacement__ : Adds a new displacement shader to the graph. 121 | - __AddDisplacementBlender__ : Adds a new displacement blender shader to the graph. 122 | - __AddRoundCorner__ : Adds a new Round Corners shader to the graph. 123 | 124 | - __AddFresnel__ : Adds a new Fresnel shader to the graph. 125 | - __AddAO__ : Adds a new AO shader to the graph. 126 | - __AddCurvature__ : Adds a new Curvature shader to the graph. 127 | - __AddFlakes__ : Adds a new Flakes shader to the graph. 128 | - __AddPointAttribute__ : Adds a new Point Attribute shader to the graph. 129 | - __AddVertexAttribute__ : Adds a new Vertex Attribute shader to the graph. 130 | 131 | - __AddRamp__ : Adds a new ramp shader to the graph. 132 | - __AddScalarRamp__ : Adds a new scalar ramp shader to the graph. 133 | - __AddTriPlanar__ : Adds a new TriPlanar shader to the graph. 134 | - __AddMaxonNoise__ : Adds a new maxonnoise shader to the graph. 135 | - __AddTexture__ : Adds a new texture shader to the graph. 136 | 137 | 138 | - __AddtoOutput__ : Add a Displacement shader to the given slot(option). 139 | - __AddtoDisplacement__ : Add a Displacement shader to the given slot(option). 140 | 141 | - __AddTextureTree__ : Adds a texture tree (tex + color correction + ramp) to the graph. 142 | - __AddDisplacementTree__ : Adds a displacement tree (tex + displacement) to the graph. 143 | - __AddBumpTree__ :Adds a bump tree (tex + bump) to the graph. 144 | 145 | ### SceneHelper Class/method highlighted: 146 | 147 | - __add_hdr_dome__ : Add a texture (hdr) dome light to the scene. 148 | - __add_rgb_dome__ : Add a rgb dome light to the scene. 149 | - __add_dome_rig__ : Add a HDR and visible dome light folder. 150 | - __add_light__ : Add an Redshift light to the secne. 151 | - __add_light_texture__ : Add textures to given Redshift light tag. 152 | - __add_ies__ : Add an Redshift ies light to the secne. 153 | - __add_gobo__ : Add an Redshift gobo light to the secne. 154 | - __add_sun_rig__ : Add an Redshift sun&sky light to the secne. 155 | - __add_light_modifier__ : Add some modify tagsto given Redshift light tag. 156 | 157 | - __add_object_tag__ : Add an object tag to the given object. 158 | - __add_object_id__ : Add object tags to the given object(with id). 159 | 160 | - __add_scatter__ : Add a scatter object of given generator_node and scatter_nodes[vertex optional]. 161 | - __add_env__ : Add an RS enviroment object. 162 | - __add_vdb__ : Add an RS volume object. 163 | - __add_proxy__ : Add an RS proxy object. 164 | - __auto_proxy__ : Export objects and replace with proxy (center axis). 165 | - __add_bakeset__ : Add given objects to a new bakeset object. 166 | 167 | # Eaxmple 168 | 1. __VideoPostHelper__ : Get the renderer id and version, set the render settings. 169 | 2. __AOVHelper__ : Add/Remove/Set/Get aovs, and print aov info. 170 | 3. __MaterialHelper__ : Create an Redshift material with nodes and pbr material setup. 171 | 4. __SceneHelper__ : Create lights/tags/objects. 172 | 5. __PrintID__ : Print some ID with helper class (R2023 above just copy 'id' form node editor is easy) 173 | 174 | 175 | 176 | -------------------------------------------------------------------------------- /versions/renderEngine/redshift/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DunHouGo/renderEngine/44ca8f927b6594f294ed0c5061c26ca781dd02e7/versions/renderEngine/redshift/__init__.py -------------------------------------------------------------------------------- /versions/renderEngine/redshift/redshift_example.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | # Maxon Cinema 4D version 2023.2.1 4 | 5 | ### ========== Copyrights ========== ### 6 | 7 | """ 8 | Copyright [2023] [DunHouGo] 9 | 10 | Licensed under the Apache License, Version 2.0 (the "License"); 11 | you may not use this file except in compliance with the License. 12 | You may obtain a copy of the License at 13 | 14 | http://www.apache.org/licenses/LICENSE-2.0 15 | 16 | Unless required by applicable law or agreed to in writing, software 17 | distributed under the License is distributed on an "AS IS" BASIS, 18 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | See the License for the specific language governing permissions and 20 | limitations under the License. 21 | """ 22 | 23 | ### ========== Author INFO ========== ### 24 | __author__ = "DunHouGo" 25 | __copyright__ = "Copyright (C) 2023 Boghma" 26 | __license__ = "Apache-2.0 License" 27 | __version__ = "2023.2.1" 28 | ### ========== Import Libs ========== ### 29 | from typing import Optional 30 | import c4d,maxon 31 | from importlib import reload 32 | from renderEngine.redshift import redshift_helper as rs 33 | reload(rs) 34 | from pprint import pprint 35 | try: 36 | from redshift_id import * 37 | except: 38 | from renderEngine.redshift.redshift_id import * 39 | from renderEngine import node_helper 40 | reload(node_helper) 41 | 42 | 43 | #============================================= 44 | # Examples 45 | #============================================= 46 | 47 | 48 | #--------------------------------------------------------- 49 | # Example 01 50 | # VideoPostHelper 51 | #--------------------------------------------------------- 52 | def example_01_videopost(): 53 | # Get the RenderEngine id. 54 | render_engine: int = rs.GetRenderEngine(doc) 55 | print(f'Current render engine ID : {render_engine}.') 56 | # Get the current render version. 57 | render_version: str = rs.GetVersion() 58 | print(f'Current render engine version : {render_version}.') 59 | # Set the VideoPostHelper instance 60 | videopost_helper = rs.VideoPostHelper(doc) 61 | # Set render setting 62 | videopost_helper.denoise_on(mode=4) 63 | print('We set redshift render with OIDN denoiser') 64 | 65 | #--------------------------------------------------------- 66 | # Example 02 67 | # AOVHelper 68 | #--------------------------------------------------------- 69 | def example_02_aovs(): 70 | # Get redshift videopost 71 | videopost: c4d.documents.BaseVideoPost = rs.VideoPostHelper(doc).videopost 72 | # Set redshift AOVHelper instance 73 | aov_helper = rs.AOVHelper(videopost) 74 | 75 | # Create a redshift aov item id can find from redshift_id.py 76 | # If #name is None, defulat to type name. 77 | diff_aov = aov_helper.create_aov_shader(aov_type = REDSHIFT_AOV_TYPE_BEAUTY) 78 | # Add the DIFFUSE aov just created to the redshift aov system 79 | aov_helper.add_aov(diff_aov) 80 | 81 | # Add some aovs 82 | aov_helper.add_aov(aov_helper.create_aov_shader(aov_type = REDSHIFT_AOV_TYPE_SHADOWS, aov_name = 'My Shadow')) 83 | aov_helper.add_aov(aov_helper.create_aov_shader(REDSHIFT_AOV_TYPE_NORMALS)) 84 | aov_helper.add_aov(aov_helper.create_aov_shader(REDSHIFT_AOV_TYPE_REFLECTIONS)) 85 | aov_helper.add_aov(aov_helper.create_aov_shader(REDSHIFT_AOV_TYPE_REFRACTIONS)) 86 | aov_helper.add_aov(aov_helper.create_aov_shader(REDSHIFT_AOV_TYPE_DEPTH)) 87 | aov_helper.add_aov(aov_helper.create_aov_shader(REDSHIFT_AOV_TYPE_EMISSION)) 88 | aov_helper.add_aov(aov_helper.create_aov_shader(REDSHIFT_AOV_TYPE_CRYPTOMATTE)) 89 | last_aov = aov_helper.add_aov(aov_helper.create_aov_shader(REDSHIFT_AOV_TYPE_OBJECT_ID)) 90 | last_aov_name = aov_helper.get_name(last_aov) 91 | 92 | # Remove last aov: object id 93 | aov_helper.remove_last_aov() 94 | print(f'We remove the last AOV named: {last_aov_name}') 95 | 96 | # Remove specified aov: emission 97 | aov_helper.remove_aov_type(aov_type = REDSHIFT_AOV_TYPE_EMISSION) 98 | print(f'We remove the AOV type: EMISSION @{REDSHIFT_AOV_TYPE_EMISSION}') 99 | 100 | # update the depth aov "Use Camera Near/Far" to Flase 101 | aov_helper.update_aov(aov_type=REDSHIFT_AOV_TYPE_DEPTH, aov_id=c4d.REDSHIFT_AOV_DEPTH_USE_CAMERA_NEAR_FAR ,aov_attrib=False) 102 | print(f'We update the Depth AOV with attribute "Use Camera Near/Far" to False') 103 | 104 | # Set the #REFRACTION aov #name 105 | aov_helper.set_name(REDSHIFT_AOV_TYPE_REFRACTIONS, "new refraction name") 106 | 107 | # Get the #SHADOW aov and his #name 108 | shadow = aov_helper.get_aovs(REDSHIFT_AOV_TYPE_SHADOWS) 109 | if shadow: 110 | print(f'We find a AOV with Named {aov_helper.get_name(shadow)}') 111 | 112 | # Set the #REFRACTION aov #light group 113 | aov_helper.set_light_group(REDSHIFT_AOV_TYPE_REFRACTIONS, "new group") 114 | print(f'We add a light group the REFRACTION AOV Named: new group') 115 | 116 | # Add a puzzle matte with same id(r=g=b), aka a white mask with given id 117 | aov_helper.set_puzzle_matte(puzzle_id = 2 ,aov_name = "My Puzzle 2") 118 | print(f'We add a white puzzle matte with ID = 2 , Name = "My Puzzle 2"') 119 | 120 | # Print current aov info 121 | aov_helper.print_aov() 122 | 123 | #--------------------------------------------------------- 124 | # Example 03 125 | # MaterialHelper 126 | #--------------------------------------------------------- 127 | if rs.IsNodeBased(): 128 | 129 | #--------------------------------------------------------- 130 | # Example 01 131 | # 创建材质 132 | # Standard Surface 133 | #--------------------------------------------------------- 134 | def CreateStandard(name): 135 | # 创建Standard Surface材质 136 | redshiftMaterial = rs.MaterialHelper.CreateStandardSurface(name) 137 | # 将Standard Surface材质引入当前Document 138 | redshiftMaterial.InsertMaterial() 139 | # 将Standard Surface材质设置为激活材质 140 | redshiftMaterial.SetActive() 141 | 142 | return redshiftMaterial.material 143 | 144 | 145 | #--------------------------------------------------------- 146 | # Example 02 147 | # 新建节点 修改属性 148 | # Add and Modify Standard Surface 149 | #--------------------------------------------------------- 150 | def AddandModify(name): 151 | redshiftMaterial = rs.MaterialHelper.CreateStandardSurface(name) 152 | 153 | # modification has to be done within a transaction 154 | with rs.RSMaterialTransaction(redshiftMaterial) as transaction: 155 | 156 | # Find brdf node (in this case : standard surface) 157 | # 查找Standard Surface节点 158 | standard_surface = redshiftMaterial.helper.GetRootBRDF() 159 | 160 | # Change a shader name 161 | # 更改Standard Surface节点名称 162 | redshiftMaterial.helper.SetName(standard_surface,'My BRDF Shader') 163 | 164 | 165 | # TexPath 166 | # 贴图路径 167 | url: maxon.Url = node_helper.get_asset_str(maxon.Id("file_5b6a5fe03176444c")) 168 | tar = redshiftMaterial.helper.GetPort(standard_surface,'com.redshift3d.redshift4c4d.nodes.core.standardmaterial.base_color') 169 | 170 | # Add a Texture node and set a tex to it , change color space to RAW 171 | # 添加一个Texture shader , 设置贴图路径,并将色彩空间设置为RAW 172 | # tex_node = redshiftMaterial.AddTexture(shadername = 'YourTex', filepath = url, raw = True) 173 | 174 | 175 | # Add a texture tree to base color 176 | # 将纹理节点树(triplaner)到 base color 节点中 177 | redshiftMaterial.AddTextureTree(shadername = 'tree', filepath = url, raw = True, triplaner_node = True, scaleramp = False, target_port = tar) 178 | 179 | # Add a Displace tree 180 | # 将置换节点树 181 | redshiftMaterial.AddDisplacementTree() 182 | 183 | # Add a Bump tree 184 | # 将凹凸节点树 185 | redshiftMaterial.AddBumpTree() 186 | 187 | # 将Standard Surface材质引入当前Document 188 | redshiftMaterial.InsertMaterial() 189 | # 将Standard Surface材质设置为激活材质 190 | redshiftMaterial.SetActive() 191 | 192 | return redshiftMaterial.material 193 | 194 | #--------------------------------------------------------- 195 | # Example 03 196 | # 修改已有材质 197 | # Modify Material 198 | #--------------------------------------------------------- 199 | def ModifyMaterial(material: rs.MaterialHelper): 200 | """ 201 | This function try to modify an exsit redshift material. 202 | """ 203 | if material is None: 204 | return 205 | 206 | # for our example, the #material should be a instance of rs.MaterialHelper 207 | # then we can use our RSMaterialTransaction to modify 208 | if isinstance(material, rs.MaterialHelper): 209 | # modification has to be done within a transaction 210 | with rs.RSMaterialTransaction(material) as transaction: 211 | 212 | # add a new STD shader 213 | noise = material.AddMaxonNoise() 214 | noise_out = material.helper.GetPort(noise, 'com.redshift3d.redshift4c4d.nodes.core.maxonnoise.outcolor') 215 | output = material.helper.GetRootBRDF() 216 | 217 | material.helper.AddConnection(noise,noise_out, output, rs.PortStr.base_color) 218 | 219 | # for suitable for most cases, the #material can be a c4d.BaseMaterial 220 | # we can transfer it to a instance of rs.MaterialHelper 221 | # then we can use our RSMaterialTransaction to modify 222 | if isinstance(material, c4d.BaseMaterial): 223 | material = rs.MaterialHelper(material) 224 | # modification has to be done within a transaction 225 | with rs.RSMaterialTransaction(material) as transaction: 226 | 227 | # add a new STD shader 228 | noise = material.AddMaxonNoise() 229 | noise_out = material.helper.GetPort(noise, 'com.redshift3d.redshift4c4d.nodes.core.maxonnoise.outcolor') 230 | output = material.helper.GetRootBRDF() 231 | 232 | material.helper.AddConnection(noise,noise_out, output, rs.PortStr.base_color) 233 | return material.material 234 | 235 | #--------------------------------------------------------- 236 | # Example 04 237 | # 创建pbr材质 238 | # Create PBR Material 239 | #--------------------------------------------------------- 240 | def PBRMaterial(): 241 | redshiftMaterial = rs.MaterialHelper.CreateStandardSurface("PBR Example") 242 | redshiftMaterial.SetupTextures() 243 | # 将Standard Surface材质引入当前Document 244 | redshiftMaterial.InsertMaterial() 245 | # 将Standard Surface材质设置为激活材质 246 | redshiftMaterial.SetActive() 247 | redshiftMaterial.FastPreview() 248 | rs.OpenNodeEditor(redshiftMaterial.material) 249 | return redshiftMaterial.material 250 | #--------------------------------------------------------- 251 | # Example 05 252 | # 自定义生成ID 253 | # custom functions for IDs 254 | #--------------------------------------------------------- 255 | def PrintID(): 256 | # Mostly the string show in the node gui,then them can gennerate maxon id 257 | # 2023.2.1 Copy Id will not shipping useless str . it is easy to just copy 258 | # 输入界面显示的字符串就可以生成ID 259 | # 2023.2.1 复制ID不会附带多余字符串 可以直接复制id使用更方便 260 | StandardSurfaceShader = rs.ShaderID.StandardMaterial 261 | StandardOutputPortString = rs.PortStr.standard_outcolor 262 | StandardOutputPortID = rs.PortID.standard_outcolor 263 | curvature_out = rs.StrPortID("curvature", "out") 264 | print("Name: " + str(StandardSurfaceShader), "Type: " , type(StandardSurfaceShader) ) 265 | print("Name: " + str(StandardOutputPortString), "Type: " , type(StandardOutputPortString) ) 266 | print("Name: " + str(StandardOutputPortID), "Type: " , type(StandardOutputPortID) ) 267 | print("Name: " + str(curvature_out), "Type: " , type(curvature_out) ) 268 | 269 | 270 | #--------------------------------------------------------- 271 | # Example 04 272 | # SceneHelper 273 | #--------------------------------------------------------- 274 | def example_04_scenes(): 275 | # Set Redshift SceneHelper instance 276 | scene_helper = rs.SceneHelper(doc) 277 | 278 | ### == Light == ### 279 | # Add a rig of hdr and rgb backdrop 280 | hdr_url: str = node_helper.get_asset_str(maxon.Id("file_d21cf4cfdec8c636")) 281 | scene_helper.add_dome_rig(texture_path = hdr_url, rgb = c4d.Vector(0,0,0)) 282 | 283 | # Add a light object and and some modify tags 284 | gobo_url: maxon.Url = node_helper.get_asset_str(maxon.Id("file_66b116a34a150e7e")) 285 | mylight = scene_helper.add_light(light_name = 'My Light', texture_path = gobo_url, intensity=2, exposure=0) 286 | scene_helper.add_light_modifier(light = mylight, target = True, gsg_link = True, rand_color = True) 287 | # Add a IES light 288 | ies_url: str = node_helper.get_asset_str("file_6f300f2ba077da4a") 289 | ies = scene_helper.add_ies(light_name = 'My IES', texture_path = ies_url, intensity=1, exposure=0) 290 | 291 | ### == Tag == ### 292 | # Add a Cude object and an Redshift tag with maskID 2 293 | cube = c4d.BaseObject(c4d.Ocube) 294 | scene_helper.add_object_id(node=cube, maskID=2) 295 | doc.InsertObject(cube) 296 | 297 | ### == Object == ### 298 | # Add a scatter obejct with some children and count 12345 299 | generate_object = c4d.BaseObject(c4d.Oplane) 300 | doc.InsertObject(generate_object) 301 | scatter_A = c4d.BaseObject(c4d.Oplatonic) 302 | scatter_B = c4d.BaseObject(c4d.Ooiltank) 303 | doc.InsertObject(scatter_A) 304 | doc.InsertObject(scatter_B) 305 | scatters: list[c4d.BaseObject] = [scatter_A, scatter_B] 306 | scene_helper.add_scatter(generator_node=generate_object, scatter_nodes=scatters, count=12345) 307 | 308 | # Add a object and set auto proxy 309 | the_object = c4d.BaseObject(c4d.Oplane) 310 | doc.InsertObject(the_object) 311 | the_object.SetName("Original Object") 312 | scene_helper.auto_proxy(node=the_object,remove_objects=False) 313 | 314 | if __name__ == '__main__': 315 | # --- 1 --- # 316 | example_01_videopost() 317 | # --- 2 --- # 318 | example_02_aovs() 319 | # --- 3 --- # 320 | example1 = CreateStandard("1.Standard Surface") 321 | example2 = AddandModify("2.Add and Modify Material") 322 | example3 = ModifyMaterial(rs.MaterialHelper(example1)) 323 | example3.SetName("3.Modify Material") 324 | example4 = PBRMaterial() 325 | # --- 4 --- # 326 | example_04_scenes() 327 | # --- 5 --- # 328 | PrintID() 329 | 330 | # Put Refresh 331 | c4d.EventAdd() -------------------------------------------------------------------------------- /versions/renderEngine/redshift/redshift_id.py: -------------------------------------------------------------------------------- 1 | import c4d 2 | 3 | 4 | ### ========== Redshift ID ========== ### 5 | # Redshift ID 6 | ID_REDSHIFT_VIDEO_POST = 1036219 7 | 8 | REDSHIFT_AOV_TYPE_WORLD_POSITION = 0 9 | REDSHIFT_AOV_TYPE_DEPTH = 1 10 | REDSHIFT_AOV_TYPE_PUZZLE_MATTE = 2 11 | REDSHIFT_AOV_TYPE_MOTION_VECTORS = 3 12 | REDSHIFT_AOV_TYPE_OBJECT_ID = 4 13 | REDSHIFT_AOV_TYPE_DIFFUSE_LIGHTING = 5 14 | REDSHIFT_AOV_TYPE_DIFFUSE_LIGHTING_RAW = 6 15 | REDSHIFT_AOV_TYPE_DIFFUSE_FILTER = 7 16 | REDSHIFT_AOV_TYPE_SPECULAR_LIGHTING = 8 17 | REDSHIFT_AOV_TYPE_SUB_SURFACE_SCATTER = 9 18 | REDSHIFT_AOV_TYPE_SUB_SURFACE_SCATTER_RAW = 10 19 | REDSHIFT_AOV_TYPE_REFLECTIONS = 11 20 | REDSHIFT_AOV_TYPE_REFLECTIONS_RAW = 12 21 | REDSHIFT_AOV_TYPE_REFLECTIONS_FILTER = 13 22 | REDSHIFT_AOV_TYPE_REFRACTIONS = 14 23 | REDSHIFT_AOV_TYPE_REFRACTIONS_RAW = 15 24 | REDSHIFT_AOV_TYPE_REFRACTIONS_FILTER = 16 25 | REDSHIFT_AOV_TYPE_EMISSION = 17 26 | REDSHIFT_AOV_TYPE_GLOBAL_ILLUMINATION = 18 27 | REDSHIFT_AOV_TYPE_GLOBAL_ILLUMINATION_RAW = 19 28 | REDSHIFT_AOV_TYPE_CAUSTICS = 20 29 | REDSHIFT_AOV_TYPE_CAUSTICS_RAW = 21 30 | REDSHIFT_AOV_TYPE_AMBIENT_OCCLUSION = 22 31 | REDSHIFT_AOV_TYPE_SHADOWS = 23 32 | REDSHIFT_AOV_TYPE_NORMALS = 24 33 | REDSHIFT_AOV_TYPE_BUMP_NORMALS = 25 34 | REDSHIFT_AOV_TYPE_MATTE = 26 35 | REDSHIFT_AOV_TYPE_VOLUME_LIGHTING = 27 36 | REDSHIFT_AOV_TYPE_VOLUME_FOG_TINT = 28 37 | REDSHIFT_AOV_TYPE_VOLUME_FOG_EMISSION = 29 38 | REDSHIFT_AOV_TYPE_TRANSLUCENCY_LIGHTING_RAW = 30 39 | REDSHIFT_AOV_TYPE_TRANSLUCENCY_FILTER = 31 40 | REDSHIFT_AOV_TYPE_TRANSLUCENCY_GI_RAW = 32 41 | REDSHIFT_AOV_TYPE_TOTAL_DIFFUSE_LIGHTING_RAW = 33 42 | REDSHIFT_AOV_TYPE_TOTAL_TRANSLUCENCY_LIGHTING_RAW = 34 43 | REDSHIFT_AOV_TYPE_OBJECT_SPACE_POSITIONS = 35 44 | REDSHIFT_AOV_TYPE_OBJECT_SPACE_BUMP_NORMALS = 36 45 | REDSHIFT_AOV_TYPE_BACKGROUND = 37 46 | REDSHIFT_AOV_TYPE_MAIN = 38 47 | REDSHIFT_AOV_TYPE_CUSTOM = 39 48 | REDSHIFT_AOV_TYPE_IDS_AND_COVERAGE = 40 49 | REDSHIFT_AOV_TYPE_BEAUTY = 41 50 | REDSHIFT_AOV_TYPE_CRYPTOMATTE = 42 51 | REDSHIFT_AOV_TYPE_MAX = 43 52 | REDSHIFT_AOV_TYPE_NONE = 65535 53 | 54 | REDSHIFT_AOV_LIGHTGROUP_GLOBALAOV = 1024 55 | REDSHIFT_AOV_LIGHTGROUP_ALL = 1025 56 | REDSHIFT_AOV_LIGHTGROUP_NAMES = 1026 57 | 58 | REDSHIFT_AOV_PUZZLE_MATTE_MODE_MATERIAL_ID = 0 59 | REDSHIFT_AOV_PUZZLE_MATTE_MODE_OBJECT_ID = 1 60 | 61 | 62 | REDSHIFT_AOVS = [ 63 | REDSHIFT_AOV_TYPE_WORLD_POSITION, 64 | REDSHIFT_AOV_TYPE_DEPTH, 65 | REDSHIFT_AOV_TYPE_PUZZLE_MATTE, 66 | REDSHIFT_AOV_TYPE_MOTION_VECTORS, 67 | REDSHIFT_AOV_TYPE_OBJECT_ID, 68 | REDSHIFT_AOV_TYPE_DIFFUSE_LIGHTING, 69 | REDSHIFT_AOV_TYPE_DIFFUSE_LIGHTING_RAW, 70 | REDSHIFT_AOV_TYPE_DIFFUSE_FILTER, 71 | REDSHIFT_AOV_TYPE_SPECULAR_LIGHTING, 72 | REDSHIFT_AOV_TYPE_SUB_SURFACE_SCATTER, 73 | REDSHIFT_AOV_TYPE_SUB_SURFACE_SCATTER_RAW, 74 | REDSHIFT_AOV_TYPE_REFLECTIONS, 75 | REDSHIFT_AOV_TYPE_REFLECTIONS_RAW, 76 | REDSHIFT_AOV_TYPE_REFLECTIONS_FILTER, 77 | REDSHIFT_AOV_TYPE_REFRACTIONS, 78 | REDSHIFT_AOV_TYPE_REFRACTIONS_RAW, 79 | REDSHIFT_AOV_TYPE_REFRACTIONS_FILTER, 80 | REDSHIFT_AOV_TYPE_EMISSION, 81 | REDSHIFT_AOV_TYPE_GLOBAL_ILLUMINATION, 82 | REDSHIFT_AOV_TYPE_GLOBAL_ILLUMINATION_RAW, 83 | REDSHIFT_AOV_TYPE_CAUSTICS, 84 | REDSHIFT_AOV_TYPE_CAUSTICS_RAW, 85 | REDSHIFT_AOV_TYPE_AMBIENT_OCCLUSION, 86 | REDSHIFT_AOV_TYPE_SHADOWS, 87 | REDSHIFT_AOV_TYPE_NORMALS, 88 | REDSHIFT_AOV_TYPE_BUMP_NORMALS, 89 | REDSHIFT_AOV_TYPE_MATTE, 90 | REDSHIFT_AOV_TYPE_VOLUME_LIGHTING, 91 | REDSHIFT_AOV_TYPE_VOLUME_FOG_TINT, 92 | REDSHIFT_AOV_TYPE_VOLUME_FOG_EMISSION, 93 | REDSHIFT_AOV_TYPE_TRANSLUCENCY_LIGHTING_RAW, 94 | REDSHIFT_AOV_TYPE_TRANSLUCENCY_FILTER, 95 | REDSHIFT_AOV_TYPE_TRANSLUCENCY_GI_RAW, 96 | REDSHIFT_AOV_TYPE_TOTAL_DIFFUSE_LIGHTING_RAW, 97 | REDSHIFT_AOV_TYPE_TOTAL_TRANSLUCENCY_LIGHTING_RAW, 98 | REDSHIFT_AOV_TYPE_OBJECT_SPACE_POSITIONS, 99 | REDSHIFT_AOV_TYPE_OBJECT_SPACE_BUMP_NORMALS, 100 | REDSHIFT_AOV_TYPE_BACKGROUND, 101 | REDSHIFT_AOV_TYPE_MAIN, 102 | REDSHIFT_AOV_TYPE_CUSTOM, 103 | REDSHIFT_AOV_TYPE_IDS_AND_COVERAGE, 104 | REDSHIFT_AOV_TYPE_BEAUTY, 105 | REDSHIFT_AOV_TYPE_CRYPTOMATTE, 106 | REDSHIFT_AOV_TYPE_MAX, 107 | REDSHIFT_AOV_TYPE_NONE 108 | ] 109 | 110 | REDSHIFT_AOVS_NAME = [ 111 | 'World Position', 112 | 'Z', 113 | 'Puzzle Matte', 114 | 'Motion Vectors', 115 | 'Object Id', 116 | 'Diffuse Lighting', 117 | 'Diffuse Lighting Raw', 118 | 'Diffuse Filter', 119 | 'Specular Lighting', 120 | 'Sub Surface Scatter', 121 | 'Sub Surface Scatter Raw', 122 | 'Reflections', 123 | 'Reflections Raw', 124 | 'Reflections Filter', 125 | 'Refractions', 126 | 'Refractions Raw', 127 | 'Refractions Filter', 128 | 'Emission', 129 | 'Global Illumination', 130 | 'Global Illumination Raw', 131 | 'Caustics', 132 | 'Caustics Raw', 133 | 'Ambient Occlusion', 134 | 'Shadows', 135 | 'Normals', 136 | 'Bump Normals', 137 | 'Matte', 138 | 'Volume Lighting', 139 | 'Volume Fog Tint', 140 | 'Volume Fog Emission', 141 | 'Translucency Lighting Raw', 142 | 'Translucency Filter', 143 | 'Translucency Gi Raw', 144 | 'Total Diffuse Lighting Raw', 145 | 'Total Translucency Lighting Raw', 146 | 'Object Space Positions', 147 | 'Object Space Bump Normals', 148 | 'Background', 149 | 'Main', 150 | 'Custom', 151 | 'Ids And Coverage', 152 | 'Beauty', 153 | 'Cryptomatte', 154 | 'Max', 155 | 'None'] 156 | 157 | 158 | ID_PREFERENCES_NODE = 465001632 # Prefs ID 159 | ID_REDSHIFT = 1036219 # Redshift 160 | 161 | ID_REDSHIFT_LIGHT = 1036751 162 | ID_REDSHIFT_RSSKY = 1036754 163 | 164 | ID_REDSHIFT_TAG = 1036222 165 | ID_REDSHIFT_ENVIROMENT = 1036757 166 | ID_REDSHIFT_VOLUME = 1038655 167 | ID_REDSHIFT_BAKESET = 1040211 168 | 169 | ID_REDSHIFT_PROXY = 1038649 170 | 171 | REDSHIFT_PROXY_DISPLAY_MODE_OFF = 0 172 | REDSHIFT_PROXY_DISPLAY_MODE_BOUNDING_BOX = 1 173 | REDSHIFT_PROXY_DISPLAY_MODE_MESH = 2 174 | 175 | REDSHIFT_PROXY_MATERIAL_MODE_INTERNAL = 0 176 | REDSHIFT_PROXY_MATERIAL_MODE_SCENE_PLACEHOLDER = 1 177 | REDSHIFT_PROXY_MATERIAL_MODE_SCENE_NAME = 2 178 | 179 | REDSHIFT_CAMERA = 1057516 --------------------------------------------------------------------------------