├── .github └── FUNDING.yml ├── Backgrounds.py ├── Effects ├── ActionCylinder.py ├── ActionPlanes.py ├── CircularFlashPlane.py ├── ColorFlashPlane.py ├── Drivers │ ├── ActionPlanesDrivers.py │ ├── CircularFlashDrivers.py │ ├── ColorFlashDrivers.py │ ├── DriverList.py │ └── GradientFlashDrivers.py └── GradientFlashPlane.py ├── GroundPlanes ├── Drivers │ ├── GrassPlaneDrivers.py │ ├── IcePlaneDrivers.py │ ├── RoadPlaneDrivers.py │ ├── RockWallPlaneDrivers.py │ ├── SandPlaneDrivers.py │ ├── StonePathPlaneDrivers.py │ └── WaterPlanesDrivers.py ├── GrassPlane.py ├── IcePlane.py ├── RoadPlane.py ├── RockWallPlane.py ├── SandPlane.py ├── StonePathPlane.py └── WaterPlanes.py ├── LICENSE ├── Objects ├── Drivers │ └── RockDrivers.py ├── ElectricArcSphere.py ├── EnergyRing.py ├── EnergySphere.py ├── Explosion.py ├── FirePlane.py ├── HeatRipplePlane.py ├── LightBeamPlane.py ├── LightSpotPlane.py ├── RainPlane.py ├── Rock.py ├── SceneryConveyor.py ├── SmokeCloud.py ├── SmokeRing.py └── SmokeTrail.py ├── README.md ├── __init__.py └── screenshots ├── ActionPlanes.png ├── BlueSky.png ├── CircularFlash.png ├── ColorFlash.png ├── ElectricArc.png ├── EnergyRing.png ├── EnergySphere.png ├── Explosion.png ├── FirePlane.png ├── GhibliGenerator.PNG ├── GradientFlash.png ├── GrassPlane.png ├── HeatRipple.png ├── IcePlane.png ├── Overcast.png ├── RainPlane.png ├── RoadPlane.png ├── Rock.png ├── RockWallPlane.png ├── SandPlane.png ├── SmokeCloud.png ├── SmokeRing.png ├── SmokeTrail.png ├── StarryNight.png ├── StonePath.png ├── Sunset.png ├── Twilight.png └── WaterPlanes.png /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: spectralvectors 4 | patreon: spectralvectors 5 | open_collective: # Replace with a single Open Collective username 6 | ko_fi: spectralvectors 7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel 8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry 9 | liberapay: # Replace with a single Liberapay username 10 | issuehunt: # Replace with a single IssueHunt username 11 | otechie: # Replace with a single Otechie username 12 | lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry 13 | custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] 14 | -------------------------------------------------------------------------------- /Backgrounds.py: -------------------------------------------------------------------------------- 1 | import bpy 2 | 3 | # Default Color Background 4 | def DefaultBG(): 5 | node_tree = bpy.data.worlds['World'].node_tree 6 | 7 | node_tree.nodes.clear() 8 | 9 | nodes = node_tree.nodes 10 | 11 | output = nodes.new(type='ShaderNodeOutputMaterial') 12 | background = nodes.new(type='ShaderNodeBackground') 13 | background.inputs[0].default_value = [0.050876, 0.050876, 0.050876, 1.000000] 14 | 15 | links = node_tree.links 16 | 17 | links.new(background.outputs[0], output.inputs[0]) 18 | 19 | # Blue Sky Background 20 | def BlueSkyBG(): 21 | node_tree = bpy.data.worlds['World'].node_tree 22 | 23 | node_tree.nodes.clear() 24 | 25 | nodes = node_tree.nodes 26 | 27 | output = nodes.new(type='ShaderNodeOutputMaterial') 28 | background = nodes.new(type='ShaderNodeBackground') 29 | colorramp = nodes.new(type='ShaderNodeValToRGB') 30 | colorramp.color_ramp.interpolation = 'B_SPLINE' 31 | colorramp.color_ramp.elements.new(0.5) 32 | colorramp.color_ramp.elements[0].position = 0 33 | colorramp.color_ramp.elements[1].position = 0.3 34 | colorramp.color_ramp.elements[2].position = 0.7 35 | colorramp.color_ramp.elements[0].color = [0.639438, 0.775820, 0.390884, 1.000000] 36 | colorramp.color_ramp.elements[1].color = [0.000000, 0.016061, 1.000000, 1.000000] 37 | colorramp.color_ramp.elements[2].color = [0.003531, 0.000000, 0.329258, 1.000000] 38 | gradient = nodes.new(type='ShaderNodeTexGradient') 39 | mapping = nodes.new(type='ShaderNodeMapping') 40 | mapping.inputs[1].default_value = (0.3, 0, 0) 41 | mapping.inputs[2].default_value = (0, 1.5708, 0) 42 | texcoord = nodes.new(type='ShaderNodeTexCoord') 43 | 44 | links = node_tree.links 45 | 46 | links.new(background.outputs[0], output.inputs[0]) 47 | links.new(colorramp.outputs[0], background.inputs[0]) 48 | links.new(gradient.outputs[0], colorramp.inputs[0]) 49 | links.new(mapping.outputs[0], gradient.inputs[0]) 50 | links.new(texcoord.outputs[0], mapping.inputs[0]) 51 | 52 | # Sunset Background 53 | def SunsetBG(): 54 | node_tree = bpy.data.worlds['World'].node_tree 55 | 56 | node_tree.nodes.clear() 57 | 58 | nodes = node_tree.nodes 59 | 60 | output = nodes.new(type='ShaderNodeOutputMaterial') 61 | background = nodes.new(type='ShaderNodeBackground') 62 | colorramp = nodes.new(type='ShaderNodeValToRGB') 63 | colorramp.color_ramp.interpolation = 'B_SPLINE' 64 | colorramp.color_ramp.elements.new(0.5) 65 | colorramp.color_ramp.elements.new(0.25) 66 | colorramp.color_ramp.elements.new(0.125) 67 | colorramp.color_ramp.elements.new(0.062) 68 | colorramp.color_ramp.elements[0].position = 0 69 | colorramp.color_ramp.elements[1].position = 0.2 70 | colorramp.color_ramp.elements[2].position = 0.4 71 | colorramp.color_ramp.elements[3].position = 0.6 72 | colorramp.color_ramp.elements[4].position = 0.8 73 | colorramp.color_ramp.elements[5].position = 1 74 | colorramp.color_ramp.elements[0].color = [0.861933, 1.000000, 0.000000, 1.000000] 75 | colorramp.color_ramp.elements[1].color = [0.500000, 0.089998, 0.000000, 1.000000] 76 | colorramp.color_ramp.elements[2].color = [0.400000, 0.001788, 0.000000, 1.000000] 77 | colorramp.color_ramp.elements[3].color = [0.300000, 0.000000, 0.080976, 1.000000] 78 | colorramp.color_ramp.elements[4].color = [0.192383, 0.000000, 0.200000, 1.000000] 79 | colorramp.color_ramp.elements[5].color = [0.000000, 0.002117, 0.100000, 1.000000] 80 | gradient = nodes.new(type='ShaderNodeTexGradient') 81 | mapping = nodes.new(type='ShaderNodeMapping') 82 | mapping.inputs[1].default_value = (0.3, 0, 0) 83 | mapping.inputs[2].default_value = (0, 1.5708, 0) 84 | texcoord = nodes.new(type='ShaderNodeTexCoord') 85 | 86 | links = node_tree.links 87 | 88 | links.new(background.outputs[0], output.inputs[0]) 89 | links.new(colorramp.outputs[0], background.inputs[0]) 90 | links.new(gradient.outputs[0], colorramp.inputs[0]) 91 | links.new(mapping.outputs[0], gradient.inputs[0]) 92 | links.new(texcoord.outputs[0], mapping.inputs[0]) 93 | 94 | # Overcast Background 95 | def OvercastBG(): 96 | node_tree = bpy.data.worlds['World'].node_tree 97 | 98 | node_tree.nodes.clear() 99 | 100 | nodes = node_tree.nodes 101 | 102 | output = nodes.new(type='ShaderNodeOutputMaterial') 103 | background = nodes.new(type='ShaderNodeBackground') 104 | colorramp = nodes.new(type='ShaderNodeValToRGB') 105 | colorramp.color_ramp.interpolation = 'B_SPLINE' 106 | colorramp.color_ramp.elements.new(0.5) 107 | colorramp.color_ramp.elements[0].position = 0 108 | colorramp.color_ramp.elements[1].position = 0.3 109 | colorramp.color_ramp.elements[2].position = 0.7 110 | colorramp.color_ramp.elements[0].color = [0.3, 0.3, 0.3, 1.000000] 111 | colorramp.color_ramp.elements[1].color = [0.2, 0.2, 0.2, 1.000000] 112 | colorramp.color_ramp.elements[2].color = [0.1, 0.1, 0.1, 1.000000] 113 | gradient = nodes.new(type='ShaderNodeTexGradient') 114 | mapping = nodes.new(type='ShaderNodeMapping') 115 | mapping.inputs[1].default_value = (0.3, 0, 0) 116 | mapping.inputs[2].default_value = (0, 1.5708, 0) 117 | texcoord = nodes.new(type='ShaderNodeTexCoord') 118 | 119 | links = node_tree.links 120 | 121 | links.new(background.outputs[0], output.inputs[0]) 122 | links.new(colorramp.outputs[0], background.inputs[0]) 123 | links.new(gradient.outputs[0], colorramp.inputs[0]) 124 | links.new(mapping.outputs[0], gradient.inputs[0]) 125 | links.new(texcoord.outputs[0], mapping.inputs[0]) 126 | 127 | # Twilight Background 128 | def TwilightBG(): 129 | node_tree = bpy.data.worlds['World'].node_tree 130 | 131 | node_tree.nodes.clear() 132 | 133 | nodes = node_tree.nodes 134 | 135 | output = nodes.new(type='ShaderNodeOutputMaterial') 136 | background = nodes.new(type='ShaderNodeBackground') 137 | colorramp = nodes.new(type='ShaderNodeValToRGB') 138 | colorramp.color_ramp.interpolation = 'B_SPLINE' 139 | colorramp.color_ramp.elements.new(0.5) 140 | colorramp.color_ramp.elements.new(0.25) 141 | colorramp.color_ramp.elements.new(0.125) 142 | colorramp.color_ramp.elements[0].position = 0 143 | colorramp.color_ramp.elements[1].position = 0.2 144 | colorramp.color_ramp.elements[2].position = 0.4 145 | colorramp.color_ramp.elements[3].position = 0.7 146 | colorramp.color_ramp.elements[4].position = 0.9 147 | colorramp.color_ramp.elements[0].color = [0.000000, 0.029845, 0.007454, 1.000000] 148 | colorramp.color_ramp.elements[1].color = [0.010390, 0.067757, 0.099999, 1.000000] 149 | colorramp.color_ramp.elements[2].color = [0.006086, 0.006665, 0.022857, 1.000000] 150 | colorramp.color_ramp.elements[3].color = [0.004441, 0.010000, 0.007736, 1.000000] 151 | colorramp.color_ramp.elements[4].color = [0.000000, 0.000000, 0.000000, 1.000000] 152 | gradient = nodes.new(type='ShaderNodeTexGradient') 153 | mapping = nodes.new(type='ShaderNodeMapping') 154 | mapping.inputs[1].default_value = (0.3, 0, 0) 155 | mapping.inputs[2].default_value = (0, 1.5708, 0) 156 | texcoord = nodes.new(type='ShaderNodeTexCoord') 157 | 158 | links = node_tree.links 159 | 160 | links.new(background.outputs[0], output.inputs[0]) 161 | links.new(colorramp.outputs[0], background.inputs[0]) 162 | links.new(gradient.outputs[0], colorramp.inputs[0]) 163 | links.new(mapping.outputs[0], gradient.inputs[0]) 164 | links.new(texcoord.outputs[0], mapping.inputs[0]) 165 | 166 | # Starry Night Background 167 | def StarryNightBG(): 168 | node_tree = bpy.data.worlds['World'].node_tree 169 | 170 | node_tree.nodes.clear() 171 | 172 | nodes = node_tree.nodes 173 | 174 | output = nodes.new(type='ShaderNodeOutputMaterial') 175 | mixshader = nodes.new(type='ShaderNodeMixShader') 176 | background = nodes.new(type='ShaderNodeBackground') 177 | colorramp1 = nodes.new(type='ShaderNodeValToRGB') 178 | colorramp1.color_ramp.interpolation = 'B_SPLINE' 179 | colorramp1.color_ramp.elements.new(0.5) 180 | colorramp1.color_ramp.elements[0].position = 0 181 | colorramp1.color_ramp.elements[1].position = 0.1 182 | colorramp1.color_ramp.elements[2].position = 1 183 | colorramp1.color_ramp.elements[0].color = [0.000000, 0.000566, 0.050000, 1.000000] 184 | colorramp1.color_ramp.elements[1].color = [0.000000, 0.000226, 0.020000, 1.000000] 185 | colorramp1.color_ramp.elements[2].color = [0.000000, 0.000000, 0.000000, 1.000000] 186 | gradient = nodes.new(type='ShaderNodeTexGradient') 187 | mapping = nodes.new(type='ShaderNodeMapping') 188 | mapping.inputs[1].default_value = (0.3, 0, 0) 189 | mapping.inputs[2].default_value = (0, 1.5708, 0) 190 | texcoord = nodes.new(type='ShaderNodeTexCoord') 191 | 192 | emission = nodes.new(type='ShaderNodeEmission') 193 | emission.inputs[1].default_value = 100 194 | colorramp2 = nodes.new(type='ShaderNodeValToRGB') 195 | colorramp2.color_ramp.elements[0].position = 0.8 196 | colorramp2.color_ramp.elements[1].position = 1 197 | noise = nodes.new(type='ShaderNodeTexNoise') 198 | noise.inputs[2].default_value = 300 199 | 200 | links = node_tree.links 201 | 202 | links.new(mixshader.outputs[0], output.inputs[0]) 203 | links.new(background.outputs[0], mixshader.inputs[1]) 204 | links.new(emission.outputs[0], mixshader.inputs[2]) 205 | links.new(colorramp1.outputs[0], background.inputs[0]) 206 | links.new(gradient.outputs[0], colorramp1.inputs[0]) 207 | links.new(mapping.outputs[0], gradient.inputs[0]) 208 | links.new(texcoord.outputs[0], mapping.inputs[0]) 209 | 210 | links.new(colorramp2.outputs[0], emission.inputs[0]) 211 | links.new(noise.outputs[0], colorramp2.inputs[0]) 212 | 213 | class OBJECT_OT_generateDefaultBG(bpy.types.Operator): 214 | """Create the default Blender background""" 215 | bl_idname = "mesh.generate_default" 216 | bl_label = "Returns to the Blender default background" 217 | bl_options = {'REGISTER', 'UNDO'} 218 | 219 | def execute(self, context): 220 | 221 | DefaultBG() 222 | 223 | return {'FINISHED'} 224 | 225 | class OBJECT_OT_generateBlueSkyBG(bpy.types.Operator): 226 | """Create a blue sky background""" 227 | bl_idname = "mesh.generate_blue_sky" 228 | bl_label = "Add a blue sky background" 229 | bl_options = {'REGISTER', 'UNDO'} 230 | 231 | def execute(self, context): 232 | 233 | BlueSkyBG() 234 | 235 | return {'FINISHED'} 236 | 237 | class OBJECT_OT_generateSunsetBG(bpy.types.Operator): 238 | """Create a sunset/sunrise background""" 239 | bl_idname = "mesh.generate_sunset" 240 | bl_label = "Add a sunset/sunrise background" 241 | bl_options = {'REGISTER', 'UNDO'} 242 | 243 | def execute(self, context): 244 | 245 | SunsetBG() 246 | 247 | return {'FINISHED'} 248 | 249 | class OBJECT_OT_generateOvercastBG(bpy.types.Operator): 250 | """Create an overcast background""" 251 | bl_idname = "mesh.generate_overcast" 252 | bl_label = "Add an overcast background" 253 | bl_options = {'REGISTER', 'UNDO'} 254 | 255 | def execute(self, context): 256 | 257 | OvercastBG() 258 | 259 | return {'FINISHED'} 260 | 261 | class OBJECT_OT_generateTwilightBG(bpy.types.Operator): 262 | """Create a twilight background""" 263 | bl_idname = "mesh.generate_twilight" 264 | bl_label = "Add a twilight background" 265 | bl_options = {'REGISTER', 'UNDO'} 266 | 267 | def execute(self, context): 268 | 269 | TwilightBG() 270 | 271 | return {'FINISHED'} 272 | 273 | class OBJECT_OT_generateStarryNightBG(bpy.types.Operator): 274 | """Create a starry night background""" 275 | bl_idname = "mesh.generate_starry_night" 276 | bl_label = "Add a starry night background" 277 | bl_options = {'REGISTER', 'UNDO'} 278 | 279 | def execute(self, context): 280 | 281 | StarryNightBG() 282 | 283 | return {'FINISHED'} 284 | -------------------------------------------------------------------------------- /Effects/ActionCylinder.py: -------------------------------------------------------------------------------- 1 | # Creating Action Cylinder 2 | 3 | import bpy 4 | 5 | bpy.ops.mesh.primitive_cylinder_add(radius=1, depth=2, end_fill_type='NOTHING') 6 | bpy.ops.object.shade_smooth() 7 | 8 | bpy.ops.object.editmode_toggle() 9 | bpy.ops.mesh.select_all(action='DESELECT') 10 | 11 | bpy.ops.object.editmode_toggle() 12 | bpy.context.object.data.edges[0].select = True 13 | 14 | bpy.ops.object.editmode_toggle() 15 | bpy.ops.mesh.loop_multi_select(ring=False) 16 | bpy.ops.transform.resize(value=(0, 0, 0)) -------------------------------------------------------------------------------- /Effects/ActionPlanes.py: -------------------------------------------------------------------------------- 1 | # Action Planes 2 | import bpy 3 | 4 | from .Drivers.ActionPlanesDrivers import * 5 | 6 | def generateActionPlanes(): 7 | 8 | bpy.ops.mesh.primitive_plane_add(size=4, enter_editmode=False, align='WORLD', location=(0, 0, 0), scale=(1, 1, 1)) 9 | nearplane = bpy.context.object 10 | nearplane.rotation_euler[1] = 1.5708 11 | nearplane.name = 'NearLines' 12 | bpy.ops.object.shade_smooth() 13 | 14 | bpy.ops.mesh.primitive_plane_add(size=6, enter_editmode=False, align='WORLD', location=(-2, 0, 0), scale=(1, 1, 1)) 15 | farplane = bpy.context.object 16 | farplane.rotation_euler[1] = 1.5708 17 | farplane.name = 'FarLines' 18 | bpy.ops.object.shade_smooth() 19 | 20 | bpy.ops.mesh.primitive_plane_add(size=10, enter_editmode=False, align='WORLD', location=(-5, 0, 0), scale=(1, 1, 1)) 21 | gradientplane = bpy.context.object 22 | gradientplane.rotation_euler[1] = 1.5708 23 | gradientplane.name = 'GradientBG' 24 | bpy.ops.object.shade_smooth() 25 | 26 | actionmat = bpy.data.materials.new(name='ActionMaterial') 27 | actionmat.use_nodes = True 28 | actionmat.node_tree.nodes.clear() 29 | actionmat.blend_method = 'BLEND' 30 | actionmat.shadow_method = 'NONE' 31 | 32 | nodes = actionmat.node_tree.nodes 33 | 34 | output = nodes.new(type='ShaderNodeOutputMaterial') 35 | 36 | #Opacity Mix Nodes Start 37 | opacitymix = nodes.new(type='ShaderNodeMixShader') 38 | opacitytransparent = nodes.new(type='ShaderNodeBsdfTransparent') 39 | opacityinvert = nodes.new(type='ShaderNodeInvert') 40 | opacityinvert.inputs[1].default_value = (1,1,1,1) 41 | #Opacity Mix Nodes End 42 | 43 | mixshader = nodes.new(type='ShaderNodeMixShader') 44 | 45 | emission = nodes.new(type='ShaderNodeEmission') 46 | emission.inputs[1].default_value = 10 47 | transparent = nodes.new(type='ShaderNodeBsdfTransparent') 48 | 49 | colorramp = nodes.new(type='ShaderNodeValToRGB') 50 | colorramp.color_ramp.elements[1].position = 0.35 51 | colorramp.color_ramp.elements[1].color = (1, 1, 1, 1) 52 | colorramp.color_ramp.elements[0].color = (0, 0, 0, 1) 53 | colorramp.color_ramp.interpolation = 'CONSTANT' 54 | 55 | colorramp1 = nodes.new(type='ShaderNodeValToRGB') 56 | colorramp1.color_ramp.elements[1].position = 0.2 57 | colorramp1.color_ramp.elements[1].color = (0, 0, 0, 1) 58 | colorramp1.color_ramp.elements[0].color = (1, 1, 1, 1) 59 | colorramp1.color_ramp.interpolation = 'CONSTANT' 60 | 61 | noise = nodes.new(type='ShaderNodeTexNoise') 62 | noise.inputs[2].default_value = 10 63 | 64 | mapping = nodes.new(type='ShaderNodeMapping') 65 | mapping.inputs[3].default_value = (0.1, 2, 1) 66 | 67 | texcoord = nodes.new(type='ShaderNodeTexCoord') 68 | 69 | links = actionmat.node_tree.links 70 | 71 | links.new(opacitymix.outputs[0], output.inputs[0]) 72 | 73 | links.new(opacityinvert.outputs[0], opacitymix.inputs[0]) 74 | 75 | links.new(opacitytransparent.outputs[0], opacitymix.inputs[2]) 76 | 77 | links.new(mixshader.outputs[0], opacitymix.inputs[1]) 78 | 79 | links.new(emission.outputs[0], mixshader.inputs[1]) 80 | 81 | links.new(transparent.outputs[0], mixshader.inputs[2]) 82 | 83 | links.new(colorramp.outputs[0], mixshader.inputs[0]) 84 | 85 | links.new(colorramp1.outputs[0], emission.inputs[0]) 86 | 87 | links.new(noise.outputs[0], colorramp1.inputs[0]) 88 | 89 | links.new(noise.outputs[1], colorramp.inputs[0]) 90 | 91 | links.new(mapping.outputs[0], noise.inputs[0]) 92 | 93 | links.new(texcoord.outputs[3], mapping.inputs[0]) 94 | 95 | nearplane.data.materials.append(actionmat) 96 | farplane.data.materials.append(actionmat) 97 | 98 | gradientmat = bpy.data.materials.new(name='GradientMaterial') 99 | gradientmat.use_nodes = True 100 | gradientmat.node_tree.nodes.clear() 101 | gradientmat.blend_method = 'BLEND' 102 | gradientmat.shadow_method = 'NONE' 103 | 104 | nodes = gradientmat.node_tree.nodes 105 | 106 | output = nodes.new(type='ShaderNodeOutputMaterial') 107 | 108 | #Opacity Mix Nodes Start 109 | opacitymix = nodes.new(type='ShaderNodeMixShader') 110 | opacitytransparent = nodes.new(type='ShaderNodeBsdfTransparent') 111 | opacityinvert = nodes.new(type='ShaderNodeInvert') 112 | opacityinvert.inputs[1].default_value = (1,1,1,1) 113 | #Opacity Mix Nodes End 114 | 115 | emission = nodes.new(type='ShaderNodeEmission') 116 | 117 | colorramp1 = nodes.new(type='ShaderNodeValToRGB') 118 | colorramp1.color_ramp.elements.new(0.5) 119 | colorramp1.color_ramp.elements[0].position = 0 120 | colorramp1.color_ramp.elements[1].position = 0.1 121 | colorramp1.color_ramp.elements[2].position = 1 122 | colorramp1.color_ramp.elements[0].color = (0.000491, 0.000000, 0.134770, 1.000000) 123 | colorramp1.color_ramp.elements[1].color = (0.000000, 0.080023, 0.567385, 1.000000) 124 | colorramp1.color_ramp.elements[2].color = (1, 1, 1, 1) 125 | 126 | colorramp2 = nodes.new(type='ShaderNodeValToRGB') 127 | colorramp2.color_ramp.elements.new(0.5) 128 | colorramp2.color_ramp.elements[0].position = 0.3 129 | colorramp2.color_ramp.elements[1].position = 0.5 130 | colorramp2.color_ramp.elements[2].position = 0.7 131 | colorramp2.color_ramp.elements[0].color = (0, 0, 0, 1) 132 | colorramp2.color_ramp.elements[1].color = (0.5, 0.5, 0.5, 1) 133 | colorramp2.color_ramp.elements[2].color = (0, 0, 0, 1) 134 | colorramp2.color_ramp.interpolation = 'B_SPLINE' 135 | 136 | linearlight = nodes.new(type='ShaderNodeMixRGB') 137 | linearlight.blend_type = 'LINEAR_LIGHT' 138 | linearlight.inputs[0].default_value = 0.7 139 | 140 | noise = nodes.new(type='ShaderNodeTexNoise') 141 | noise.inputs[2].default_value = 22 142 | 143 | noisemapping = nodes.new(type='ShaderNodeMapping') 144 | noisemapping.inputs[1].default_value[0] = 1 145 | noisemapping.inputs[2].default_value[2] = 1.5708 146 | noisemapping.inputs[3].default_value = (0.1, 0.5, 1) 147 | 148 | gradient = nodes.new(type='ShaderNodeTexGradient') 149 | 150 | mapping = nodes.new(type='ShaderNodeMapping') 151 | mapping.inputs[1].default_value = (0.5, 0, 0) 152 | mapping.inputs[2].default_value = (0, 0, 1.5708) 153 | mapping.inputs[3].default_value = (1, 0.15, 1) 154 | 155 | texcoord = nodes.new(type='ShaderNodeTexCoord') 156 | 157 | links = gradientmat.node_tree.links 158 | 159 | links.new(opacitymix.outputs[0], output.inputs[0]) 160 | 161 | links.new(opacityinvert.outputs[0], opacitymix.inputs[0]) 162 | 163 | links.new(opacitytransparent.outputs[0], opacitymix.inputs[2]) 164 | 165 | links.new(emission.outputs[0], opacitymix.inputs[1]) 166 | 167 | links.new(colorramp1.outputs[0], emission.inputs[0]) 168 | 169 | links.new(colorramp2.outputs[0], colorramp1.inputs[0]) 170 | 171 | links.new(linearlight.outputs[0], colorramp2.inputs[0]) 172 | 173 | links.new(gradient.outputs[0], linearlight.inputs[2]) 174 | 175 | links.new(mapping.outputs[0], gradient.inputs[0]) 176 | 177 | links.new(texcoord.outputs[3], mapping.inputs[0]) 178 | 179 | links.new(noise.outputs[0], linearlight.inputs[1]) 180 | 181 | links.new(noisemapping.outputs[0], noise.inputs[0]) 182 | 183 | links.new(texcoord.outputs[3], noisemapping.inputs[0]) 184 | 185 | gradientplane.data.materials.append(gradientmat) 186 | 187 | nearplane = bpy.data.objects['NearLines'] 188 | farplane = bpy.data.objects['FarLines'] 189 | gradientplane = bpy.data.objects['GradientBG'] 190 | 191 | farplane.parent = nearplane 192 | farplane.matrix_parent_inverse = nearplane.matrix_world.inverted() 193 | gradientplane.parent = nearplane 194 | gradientplane.matrix_parent_inverse = nearplane.matrix_world.inverted() 195 | 196 | 197 | class OBJECT_OT_generateActionPlanes(bpy.types.Operator): 198 | """Create a stylized action planes""" 199 | bl_idname = "mesh.generate_action_planes" 200 | bl_label = "Add Stylized Action Planes" 201 | bl_options = {'REGISTER', 'UNDO'} 202 | 203 | def execute(self, context): 204 | 205 | generateActionPlanes() 206 | assignDrivers() 207 | 208 | return {'FINISHED'} 209 | -------------------------------------------------------------------------------- /Effects/CircularFlashPlane.py: -------------------------------------------------------------------------------- 1 | # Circular Flash Plane 2 | import bpy 3 | 4 | from .Drivers.CircularFlashDrivers import * 5 | 6 | def generateCircularFlashPlane(): 7 | 8 | bpy.ops.mesh.primitive_plane_add(size=4, enter_editmode=False, align='WORLD', location=(0, 0, 0), scale=(1, 1, 1)) 9 | circularflash = bpy.context.object 10 | circularflash.rotation_euler[1] = 1.5708 11 | circularflash.name = 'CircularFlash' 12 | bpy.ops.object.shade_smooth() 13 | 14 | circularflashmat = bpy.data.materials.new(name='CircularFlashMaterial') 15 | circularflashmat.use_nodes = True 16 | circularflashmat.node_tree.nodes.clear() 17 | circularflashmat.blend_method = 'BLEND' 18 | circularflashmat.shadow_method = 'NONE' 19 | 20 | nodes = circularflashmat.node_tree.nodes 21 | 22 | output = nodes.new(type='ShaderNodeOutputMaterial') 23 | 24 | mixshader = nodes.new(type='ShaderNodeMixShader') 25 | 26 | emission = nodes.new(type='ShaderNodeEmission') 27 | emission.inputs[1].default_value = 20 28 | 29 | transparent = nodes.new(type='ShaderNodeBsdfTransparent') 30 | 31 | colorramp = nodes.new(type='ShaderNodeValToRGB') 32 | colorramp.color_ramp.interpolation = 'B_SPLINE' 33 | colorramp.color_ramp.elements[0].position = 0.4 34 | colorramp.color_ramp.elements[1].position = 1.0 35 | 36 | gradient = nodes.new(type='ShaderNodeTexGradient') 37 | gradient.gradient_type = 'SPHERICAL' 38 | 39 | mapping = nodes.new(type='ShaderNodeMapping') 40 | 41 | texcoord = nodes.new(type='ShaderNodeTexCoord') 42 | 43 | links = circularflashmat.node_tree.links 44 | 45 | links.new(mixshader.outputs[0], output.inputs[0]) 46 | 47 | links.new(emission.outputs[0], mixshader.inputs[1]) 48 | 49 | links.new(transparent.outputs[0], mixshader.inputs[2]) 50 | 51 | links.new(colorramp.outputs[0], emission.inputs[0]) 52 | 53 | links.new(gradient.outputs[0], colorramp.inputs[0]) 54 | 55 | links.new(mapping.outputs[0], gradient.inputs[0]) 56 | 57 | links.new(texcoord.outputs[3], mapping.inputs[0]) 58 | 59 | circularflash.data.materials.append(circularflashmat) 60 | 61 | 62 | class OBJECT_OT_generateCircularFlashPlane(bpy.types.Operator): 63 | """Create a circular gradient color plane""" 64 | bl_idname = "mesh.generate_circular_flash_plane" 65 | bl_label = "Add a circular gradient color plane" 66 | bl_options = {'REGISTER', 'UNDO'} 67 | 68 | def execute(self, context): 69 | 70 | generateCircularFlashPlane() 71 | assignDrivers() 72 | 73 | return {'FINISHED'} 74 | -------------------------------------------------------------------------------- /Effects/ColorFlashPlane.py: -------------------------------------------------------------------------------- 1 | # Color Flash Plane 2 | import bpy 3 | 4 | from .Drivers.ColorFlashDrivers import * 5 | 6 | def generateColorFlashPlane(): 7 | 8 | bpy.ops.mesh.primitive_plane_add(size=4, enter_editmode=False, align='WORLD', location=(0, 0, 0), scale=(1, 1, 1)) 9 | colorflash = bpy.context.object 10 | colorflash.rotation_euler[1] = 1.5708 11 | colorflash.name = 'ColorFlash' 12 | bpy.ops.object.shade_smooth() 13 | 14 | colorflashmat = bpy.data.materials.new(name='ColorFlashMaterial') 15 | colorflashmat.use_nodes = True 16 | colorflashmat.node_tree.nodes.clear() 17 | colorflashmat.blend_method = 'BLEND' 18 | colorflashmat.shadow_method = 'NONE' 19 | 20 | nodes = colorflashmat.node_tree.nodes 21 | 22 | output = nodes.new(type='ShaderNodeOutputMaterial') 23 | 24 | mixshader = nodes.new(type='ShaderNodeMixShader') 25 | 26 | emission = nodes.new(type='ShaderNodeEmission') 27 | emission.inputs[1].default_value = 20 28 | 29 | transparent = nodes.new(type='ShaderNodeBsdfTransparent') 30 | 31 | links = colorflashmat.node_tree.links 32 | 33 | links.new(mixshader.outputs[0], output.inputs[0]) 34 | 35 | links.new(emission.outputs[0], mixshader.inputs[1]) 36 | 37 | links.new(transparent.outputs[0], mixshader.inputs[2]) 38 | 39 | colorflash.data.materials.append(colorflashmat) 40 | 41 | 42 | class OBJECT_OT_generateColorFlashPlane(bpy.types.Operator): 43 | """Create a single color plane""" 44 | bl_idname = "mesh.generate_color_flash_plane" 45 | bl_label = "Add single color plane" 46 | bl_options = {'REGISTER', 'UNDO'} 47 | 48 | def execute(self, context): 49 | 50 | generateColorFlashPlane() 51 | assignDrivers() 52 | 53 | return {'FINISHED'} 54 | -------------------------------------------------------------------------------- /Effects/Drivers/CircularFlashDrivers.py: -------------------------------------------------------------------------------- 1 | # Assign Drivers to the Circular Flash Plane 2 | import bpy 3 | 4 | def assignDrivers(): 5 | 6 | drivers = [] 7 | 8 | object = bpy.context.object 9 | 10 | # Color1 - Red Channel 11 | d0 = { 12 | 'object': object, 13 | 'property': 'Color1', 14 | 'value': [0.0, 0.0, 0.0, 1.0], 15 | 'driven_value': 'nodes["ColorRamp"].color_ramp.elements[0].color', 16 | 'driven_object' : object.material_slots[0].material.node_tree, 17 | 'index' : 0, 18 | 'variable_name' : 'var', 19 | 'data_path' : '["Color1"][0]', 20 | 'id_type' : 'OBJECT', 21 | 'subtype': 'COLOR', 22 | 'min': 0, 23 | 'max': 1, 24 | } 25 | 26 | drivers.append(d0) 27 | 28 | # Color1 - Green Channel 29 | d1 = { 30 | 'object': object, 31 | 'property': 'Color1', 32 | 'value': [0.0, 0.0, 0.0, 1.0], 33 | 'driven_value': 'nodes["ColorRamp"].color_ramp.elements[0].color', 34 | 'driven_object' : object.material_slots[0].material.node_tree, 35 | 'index' : 1, 36 | 'variable_name' : 'var', 37 | 'data_path' : '["Color1"][1]', 38 | 'id_type' : 'OBJECT', 39 | 'subtype': 'COLOR', 40 | 'min': 0, 41 | 'max': 1, 42 | } 43 | 44 | drivers.append(d1) 45 | 46 | # Color1 - Blue Channel 47 | d2 = { 48 | 'object': object, 49 | 'property': 'Color1', 50 | 'value': [0.0, 0.0, 0.0, 1.0], 51 | 'driven_value': 'nodes["ColorRamp"].color_ramp.elements[0].color', 52 | 'driven_object' : object.material_slots[0].material.node_tree, 53 | 'index' : 2, 54 | 'variable_name' : 'var', 55 | 'data_path' : '["Color1"][2]', 56 | 'id_type' : 'OBJECT', 57 | 'subtype': 'COLOR', 58 | 'min': 0, 59 | 'max': 1, 60 | } 61 | 62 | drivers.append(d2) 63 | 64 | # Emission Strength 65 | d3 = { 66 | 'object': object, 67 | 'property': 'EmissionStrength', 68 | 'value': 20.0, 69 | 'driven_value': 'nodes["Emission"].inputs[1].default_value', 70 | 'driven_object' : object.material_slots[0].material.node_tree, 71 | 'index' : -1, 72 | 'variable_name' : 'var', 73 | 'data_path' : '["EmissionStrength"]', 74 | 'id_type' : 'OBJECT', 75 | 'subtype': '', 76 | 'min': 1, 77 | 'max': 100, 78 | } 79 | 80 | drivers.append(d3) 81 | 82 | # Transparency 83 | d4 = { 84 | 'object': object, 85 | 'property': 'Transparency', 86 | 'value': 0.0, 87 | 'driven_value': 'nodes["Mix Shader"].inputs[0].default_value', 88 | 'driven_object' : object.material_slots[0].material.node_tree, 89 | 'index' : -1, 90 | 'variable_name' : 'var', 91 | 'data_path' : '["Transparency"]', 92 | 'id_type' : 'OBJECT', 93 | 'subtype': '', 94 | 'min': 0, 95 | 'max': 1, 96 | } 97 | 98 | drivers.append(d4) 99 | 100 | # Color2 R 101 | d5 = { 102 | 'object': object, 103 | 'property': 'Color2', 104 | 'value': [1.0, 1.0, 1.0, 1.0], 105 | 'driven_value': 'nodes["ColorRamp"].color_ramp.elements[1].color', 106 | 'driven_object' : object.material_slots[0].material.node_tree, 107 | 'index' : 0, 108 | 'variable_name' : 'var', 109 | 'data_path' : '["Color2"][0]', 110 | 'id_type' : 'OBJECT', 111 | 'subtype': 'COLOR', 112 | 'min': 0, 113 | 'max': 1, 114 | } 115 | 116 | drivers.append(d5) 117 | 118 | # Color2 G 119 | d6 = { 120 | 'object': object, 121 | 'property': 'Color2', 122 | 'value': [1.0, 1.0, 1.0, 1.0], 123 | 'driven_value': 'nodes["ColorRamp"].color_ramp.elements[1].color', 124 | 'driven_object' : object.material_slots[0].material.node_tree, 125 | 'index' : 1, 126 | 'variable_name' : 'var', 127 | 'data_path' : '["Color2"][1]', 128 | 'id_type' : 'OBJECT', 129 | 'subtype': 'COLOR', 130 | 'min': 0, 131 | 'max': 1, 132 | } 133 | 134 | drivers.append(d6) 135 | 136 | # Color2 B 137 | d7 = { 138 | 'object': object, 139 | 'property': 'Color2', 140 | 'value': [1.0, 1.0, 1.0, 1.0], 141 | 'driven_value': 'nodes["ColorRamp"].color_ramp.elements[1].color', 142 | 'driven_object' : object.material_slots[0].material.node_tree, 143 | 'index' : 2, 144 | 'variable_name' : 'var', 145 | 'data_path' : '["Color2"][2]', 146 | 'id_type' : 'OBJECT', 147 | 'subtype': 'COLOR', 148 | 'min': 0, 149 | 'max': 1, 150 | } 151 | 152 | drivers.append(d7) 153 | 154 | # Circle Location Y 155 | d8 = { 156 | 'object': object, 157 | 'property': 'CircleLocationX', 158 | 'value': 0.0, 159 | 'driven_value': 'nodes["Mapping"].inputs[1].default_value', 160 | 'driven_object' : object.material_slots[0].material.node_tree, 161 | 'index' : 0, 162 | 'variable_name' : 'var', 163 | 'data_path' : '["CircleLocationX"]', 164 | 'id_type' : 'OBJECT', 165 | 'subtype': '', 166 | 'min': -1, 167 | 'max': 1, 168 | } 169 | 170 | drivers.append(d8) 171 | 172 | # Circle Location Y 173 | d9 = { 174 | 'object': object, 175 | 'property': 'CircleLocationY', 176 | 'value': 0.0, 177 | 'driven_value': 'nodes["Mapping"].inputs[1].default_value', 178 | 'driven_object' : object.material_slots[0].material.node_tree, 179 | 'index' : 1, 180 | 'variable_name' : 'var', 181 | 'data_path' : '["CircleLocationY"]', 182 | 'id_type' : 'OBJECT', 183 | 'subtype': '', 184 | 'min': -1, 185 | 'max': 1, 186 | } 187 | 188 | drivers.append(d9) 189 | 190 | # Circle Scale X 191 | d10 = { 192 | 'object': object, 193 | 'property': 'CircleScaleX', 194 | 'value': 1.0, 195 | 'driven_value': 'nodes["Mapping"].inputs[3].default_value', 196 | 'driven_object' : object.material_slots[0].material.node_tree, 197 | 'index' : 0, 198 | 'variable_name' : 'var', 199 | 'data_path' : '["CircleScaleX"]', 200 | 'id_type' : 'OBJECT', 201 | 'subtype': '', 202 | 'min': -10, 203 | 'max': 10, 204 | } 205 | 206 | drivers.append(d10) 207 | 208 | # Circle Scale Y 209 | d11 = { 210 | 'object': object, 211 | 'property': 'CircleScaleY', 212 | 'value': 1.0, 213 | 'driven_value': 'nodes["Mapping"].inputs[3].default_value', 214 | 'driven_object' : object.material_slots[0].material.node_tree, 215 | 'index' : 1, 216 | 'variable_name' : 'var', 217 | 'data_path' : '["CircleScaleY"]', 218 | 'id_type' : 'OBJECT', 219 | 'subtype': '', 220 | 'min': -10, 221 | 'max': 10, 222 | } 223 | 224 | drivers.append(d11) 225 | 226 | for d in drivers: 227 | d['object'][d['property']] = d['value'] 228 | 229 | edit_property = d['object'].id_properties_ui(d['property']) 230 | edit_property.update(min=d['min'], max=d['max']) 231 | 232 | if d['subtype']: 233 | edit_property.update(subtype=d['subtype']) 234 | 235 | driver = d['driven_object'].driver_add(d['driven_value'], d['index']) 236 | 237 | variable = driver.driver.variables.new() 238 | variable.name = d['variable_name'] 239 | variable.targets[0].id_type = d['id_type'] 240 | variable.targets[0].id = d['object'] 241 | variable.targets[0].data_path = d['data_path'] 242 | 243 | driver.driver.expression = variable.name 244 | 245 | # Update Driver Dependencies 246 | d['object'].hide_render = d['object'].hide_render 247 | -------------------------------------------------------------------------------- /Effects/Drivers/ColorFlashDrivers.py: -------------------------------------------------------------------------------- 1 | # Assign Drivers to the Color Flash Plane 2 | import bpy 3 | 4 | def assignDrivers(): 5 | 6 | drivers = [] 7 | 8 | object = bpy.context.object 9 | 10 | # Color - Red Channel 11 | d0 = { 12 | 'object': object, 13 | 'property': 'Color', 14 | 'value': [1.0, 1.0, 1.0, 1.0], 15 | 'driven_value': 'nodes["Emission"].inputs[0].default_value', 16 | 'driven_object' : object.material_slots[0].material.node_tree, 17 | 'index' : 0, 18 | 'variable_name' : 'var', 19 | 'data_path' : '["Color"][0]', 20 | 'id_type' : 'OBJECT', 21 | 'subtype': 'COLOR', 22 | 'min': 0, 23 | 'max': 1, 24 | } 25 | 26 | drivers.append(d0) 27 | 28 | # Color - Green Channel 29 | d1 = { 30 | 'object': object, 31 | 'property': 'Color', 32 | 'value': [1.0, 1.0, 1.0, 1.0], 33 | 'driven_value': 'nodes["Emission"].inputs[0].default_value', 34 | 'driven_object' : object.material_slots[0].material.node_tree, 35 | 'index' : 1, 36 | 'variable_name' : 'var', 37 | 'data_path' : '["Color"][1]', 38 | 'id_type' : 'OBJECT', 39 | 'subtype': 'COLOR', 40 | 'min': 0, 41 | 'max': 1, 42 | } 43 | 44 | drivers.append(d1) 45 | 46 | # Color - Blue Channel 47 | d2 = { 48 | 'object': object, 49 | 'property': 'Color', 50 | 'value': [1.0, 1.0, 1.0, 1.0], 51 | 'driven_value': 'nodes["Emission"].inputs[0].default_value', 52 | 'driven_object' : object.material_slots[0].material.node_tree, 53 | 'index' : 2, 54 | 'variable_name' : 'var', 55 | 'data_path' : '["Color"][2]', 56 | 'id_type' : 'OBJECT', 57 | 'subtype': 'COLOR', 58 | 'min': 0, 59 | 'max': 1, 60 | } 61 | 62 | drivers.append(d2) 63 | 64 | # Emission Strength 65 | d3 = { 66 | 'object': object, 67 | 'property': 'EmissionStrength', 68 | 'value': 20.0, 69 | 'driven_value': 'nodes["Emission"].inputs[1].default_value', 70 | 'driven_object' : object.material_slots[0].material.node_tree, 71 | 'index' : -1, 72 | 'variable_name' : 'var', 73 | 'data_path' : '["EmissionStrength"]', 74 | 'id_type' : 'OBJECT', 75 | 'subtype': '', 76 | 'min': 1, 77 | 'max': 100, 78 | } 79 | 80 | drivers.append(d3) 81 | 82 | # Transparency 83 | d4 = { 84 | 'object': object, 85 | 'property': 'Transparency', 86 | 'value': 0.0, 87 | 'driven_value': 'nodes["Mix Shader"].inputs[0].default_value', 88 | 'driven_object' : object.material_slots[0].material.node_tree, 89 | 'index' : -1, 90 | 'variable_name' : 'var', 91 | 'data_path' : '["Transparency"]', #[1] 92 | 'id_type' : 'OBJECT', 93 | 'subtype': '', 94 | 'min': 0, 95 | 'max': 1, 96 | } 97 | 98 | drivers.append(d4) 99 | 100 | # # Scale X 101 | # d5 = { 102 | # 'object': object, 103 | # 'property': 'ScaleX', 104 | # 'value': 1.0, 105 | # 'driven_value': 'scale', 106 | # 'driven_object' : object, 107 | # 'index' : 0, 108 | # 'variable_name' : 'var', 109 | # 'data_path' : '["ScaleX"][0]', 110 | # 'id_type' : 'OBJECT', 111 | # 'subtype': '', 112 | # 'min': -100, 113 | # 'max': 100, 114 | # } 115 | 116 | # drivers.append(d5) 117 | 118 | # # Scale Y 119 | # d6 = { 120 | # 'object': object, 121 | # 'property': 'ScaleY', 122 | # 'value': 1.0, 123 | # 'driven_value': 'scale', 124 | # 'driven_object' : object, 125 | # 'index' : 1, 126 | # 'variable_name' : 'var', 127 | # 'data_path' : '["ScaleY"][1]', 128 | # 'id_type' : 'OBJECT', 129 | # 'subtype': '', 130 | # 'min': -100, 131 | # 'max': 100, 132 | # } 133 | 134 | # drivers.append(d6) 135 | 136 | 137 | for d in drivers: 138 | d['object'][d['property']] = d['value'] 139 | 140 | edit_property = d['object'].id_properties_ui(d['property']) 141 | edit_property.update(min=d['min'], max=d['max']) 142 | 143 | if d['subtype']: 144 | edit_property.update(subtype=d['subtype']) 145 | 146 | driver = d['driven_object'].driver_add(d['driven_value'], d['index']) 147 | 148 | variable = driver.driver.variables.new() 149 | variable.name = d['variable_name'] 150 | variable.targets[0].id_type = d['id_type'] 151 | variable.targets[0].id = d['object'] 152 | variable.targets[0].data_path = d['data_path'] 153 | 154 | driver.driver.expression = variable.name 155 | 156 | # Update Driver Dependencies 157 | d['object'].hide_render = d['object'].hide_render 158 | -------------------------------------------------------------------------------- /Effects/Drivers/DriverList.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SpectralVectors/GhibliGenerator/236cd4aaf488849316b2c557a61772262fb91b94/Effects/Drivers/DriverList.py -------------------------------------------------------------------------------- /Effects/Drivers/GradientFlashDrivers.py: -------------------------------------------------------------------------------- 1 | # Assign Drivers to the Gradient Flash Plane 2 | import bpy 3 | 4 | def assignDrivers(): 5 | 6 | drivers = [] 7 | 8 | object = bpy.context.object 9 | 10 | # Color1 - Red Channel 11 | d0 = { 12 | 'object': object, 13 | 'property': 'Color1', 14 | 'value': [0.0, 0.0, 0.0, 1.0], 15 | 'driven_value': 'nodes["ColorRamp"].color_ramp.elements[0].color', 16 | 'driven_object' : object.material_slots[0].material.node_tree, 17 | 'index' : 0, 18 | 'variable_name' : 'var', 19 | 'data_path' : '["Color1"][0]', 20 | 'id_type' : 'OBJECT', 21 | 'subtype': 'COLOR', 22 | 'min': 0, 23 | 'max': 1, 24 | } 25 | 26 | drivers.append(d0) 27 | 28 | # Color1 - Green Channel 29 | d1 = { 30 | 'object': object, 31 | 'property': 'Color1', 32 | 'value': [0.0, 0.0, 0.0, 1.0], 33 | 'driven_value': 'nodes["ColorRamp"].color_ramp.elements[0].color', 34 | 'driven_object' : object.material_slots[0].material.node_tree, 35 | 'index' : 1, 36 | 'variable_name' : 'var', 37 | 'data_path' : '["Color1"][1]', 38 | 'id_type' : 'OBJECT', 39 | 'subtype': 'COLOR', 40 | 'min': 0, 41 | 'max': 1, 42 | } 43 | 44 | drivers.append(d1) 45 | 46 | # Color1 - Blue Channel 47 | d2 = { 48 | 'object': object, 49 | 'property': 'Color1', 50 | 'value': [0.0, 0.0, 0.0, 1.0], 51 | 'driven_value': 'nodes["ColorRamp"].color_ramp.elements[0].color', 52 | 'driven_object' : object.material_slots[0].material.node_tree, 53 | 'index' : 2, 54 | 'variable_name' : 'var', 55 | 'data_path' : '["Color1"][2]', 56 | 'id_type' : 'OBJECT', 57 | 'subtype': 'COLOR', 58 | 'min': 0, 59 | 'max': 1, 60 | } 61 | 62 | drivers.append(d2) 63 | 64 | # Emission Strength 65 | d3 = { 66 | 'object': object, 67 | 'property': 'EmissionStrength', 68 | 'value': 20.0, 69 | 'driven_value': 'nodes["Emission"].inputs[1].default_value', 70 | 'driven_object' : object.material_slots[0].material.node_tree, 71 | 'index' : -1, 72 | 'variable_name' : 'var', 73 | 'data_path' : '["EmissionStrength"]', 74 | 'id_type' : 'OBJECT', 75 | 'subtype': '', 76 | 'min': 1, 77 | 'max': 100, 78 | } 79 | 80 | drivers.append(d3) 81 | 82 | # Transparency 83 | d4 = { 84 | 'object': object, 85 | 'property': 'Transparency', 86 | 'value': 0.0, 87 | 'driven_value': 'nodes["Mix Shader"].inputs[0].default_value', 88 | 'driven_object' : object.material_slots[0].material.node_tree, 89 | 'index' : -1, 90 | 'variable_name' : 'var', 91 | 'data_path' : '["Transparency"]', 92 | 'id_type' : 'OBJECT', 93 | 'subtype': '', 94 | 'min': 0, 95 | 'max': 1, 96 | } 97 | 98 | drivers.append(d4) 99 | 100 | # Color2 R 101 | d5 = { 102 | 'object': object, 103 | 'property': 'Color2', 104 | 'value': [1.0, 1.0, 1.0, 1.0], 105 | 'driven_value': 'nodes["ColorRamp"].color_ramp.elements[1].color', 106 | 'driven_object' : object.material_slots[0].material.node_tree, 107 | 'index' : 0, 108 | 'variable_name' : 'var', 109 | 'data_path' : '["Color2"][0]', 110 | 'id_type' : 'OBJECT', 111 | 'subtype': 'COLOR', 112 | 'min': 0, 113 | 'max': 1, 114 | } 115 | 116 | drivers.append(d5) 117 | 118 | # Color2 G 119 | d6 = { 120 | 'object': object, 121 | 'property': 'Color2', 122 | 'value': [1.0, 1.0, 1.0, 1.0], 123 | 'driven_value': 'nodes["ColorRamp"].color_ramp.elements[1].color', 124 | 'driven_object' : object.material_slots[0].material.node_tree, 125 | 'index' : 1, 126 | 'variable_name' : 'var', 127 | 'data_path' : '["Color2"][1]', 128 | 'id_type' : 'OBJECT', 129 | 'subtype': 'COLOR', 130 | 'min': 0, 131 | 'max': 1, 132 | } 133 | 134 | drivers.append(d6) 135 | 136 | # Color2 B 137 | d7 = { 138 | 'object': object, 139 | 'property': 'Color2', 140 | 'value': [1.0, 1.0, 1.0, 1.0], 141 | 'driven_value': 'nodes["ColorRamp"].color_ramp.elements[1].color', 142 | 'driven_object' : object.material_slots[0].material.node_tree, 143 | 'index' : 2, 144 | 'variable_name' : 'var', 145 | 'data_path' : '["Color2"][2]', 146 | 'id_type' : 'OBJECT', 147 | 'subtype': 'COLOR', 148 | 'min': 0, 149 | 'max': 1, 150 | } 151 | 152 | drivers.append(d7) 153 | 154 | # Gradient Height 155 | d8 = { 156 | 'object': object, 157 | 'property': 'GradientHeight', 158 | 'value': 0.0, 159 | 'driven_value': 'nodes["Mapping"].inputs[1].default_value', 160 | 'driven_object' : object.material_slots[0].material.node_tree, 161 | 'index' : 0, 162 | 'variable_name' : 'var', 163 | 'data_path' : '["GradientHeight"]', 164 | 'id_type' : 'OBJECT', 165 | 'subtype': '', 166 | 'min': -1, 167 | 'max': 1, 168 | } 169 | 170 | drivers.append(d8) 171 | 172 | # # Rotation 173 | # d9 = { 174 | # 'object': object, 175 | # 'property': 'Rotation', 176 | # 'value': 0.0, 177 | # 'driven_value': 'rotation_euler', 178 | # 'driven_object' : object, 179 | # 'index' : 1, 180 | # 'variable_name' : 'var', 181 | # 'data_path' : '["Rotation"]', 182 | # 'id_type' : 'OBJECT', 183 | # 'subtype': '', 184 | # 'min': -360, 185 | # 'max': 360, 186 | # } 187 | 188 | # drivers.append(d9) 189 | 190 | for d in drivers: 191 | d['object'][d['property']] = d['value'] 192 | 193 | edit_property = d['object'].id_properties_ui(d['property']) 194 | edit_property.update(min=d['min'], max=d['max']) 195 | 196 | if d['subtype']: 197 | edit_property.update(subtype=d['subtype']) 198 | 199 | driver = d['driven_object'].driver_add(d['driven_value'], d['index']) 200 | 201 | variable = driver.driver.variables.new() 202 | variable.name = d['variable_name'] 203 | variable.targets[0].id_type = d['id_type'] 204 | variable.targets[0].id = d['object'] 205 | variable.targets[0].data_path = d['data_path'] 206 | 207 | driver.driver.expression = variable.name 208 | 209 | # Update Driver Dependencies 210 | d['object'].hide_render = d['object'].hide_render 211 | -------------------------------------------------------------------------------- /Effects/GradientFlashPlane.py: -------------------------------------------------------------------------------- 1 | # Gradient Flash Plane 2 | import bpy 3 | 4 | from .Drivers.GradientFlashDrivers import * 5 | 6 | def generateGradientFlashPlane(): 7 | 8 | bpy.ops.mesh.primitive_plane_add(size=4, enter_editmode=False, align='WORLD', location=(0, 0, 0), scale=(1, 1, 1)) 9 | gradientflash = bpy.context.object 10 | gradientflash.rotation_euler[1] = 1.5708 11 | gradientflash.name = 'GradientFlash' 12 | bpy.ops.object.shade_smooth() 13 | 14 | gradientflashmat = bpy.data.materials.new(name='GradientFlashMaterial') 15 | gradientflashmat.use_nodes = True 16 | gradientflashmat.node_tree.nodes.clear() 17 | gradientflashmat.blend_method = 'BLEND' 18 | gradientflashmat.shadow_method = 'NONE' 19 | 20 | nodes = gradientflashmat.node_tree.nodes 21 | 22 | output = nodes.new(type='ShaderNodeOutputMaterial') 23 | 24 | mixshader = nodes.new(type='ShaderNodeMixShader') 25 | 26 | emission = nodes.new(type='ShaderNodeEmission') 27 | emission.inputs[1].default_value = 20 28 | 29 | transparent = nodes.new(type='ShaderNodeBsdfTransparent') 30 | 31 | colorramp = nodes.new(type='ShaderNodeValToRGB') 32 | colorramp.color_ramp.interpolation = 'B_SPLINE' 33 | colorramp.color_ramp.elements[0].position = 0.8 34 | colorramp.color_ramp.elements[1].position = 1.0 35 | 36 | gradient = nodes.new(type='ShaderNodeTexGradient') 37 | 38 | mapping = nodes.new(type='ShaderNodeMapping') 39 | 40 | texcoord = nodes.new(type='ShaderNodeTexCoord') 41 | 42 | links = gradientflashmat.node_tree.links 43 | 44 | links.new(mixshader.outputs[0], output.inputs[0]) 45 | 46 | links.new(emission.outputs[0], mixshader.inputs[1]) 47 | 48 | links.new(transparent.outputs[0], mixshader.inputs[2]) 49 | 50 | links.new(colorramp.outputs[0], emission.inputs[0]) 51 | 52 | links.new(gradient.outputs[0], colorramp.inputs[0]) 53 | 54 | links.new(mapping.outputs[0], gradient.inputs[0]) 55 | 56 | links.new(texcoord.outputs[0], mapping.inputs[0]) 57 | 58 | gradientflash.data.materials.append(gradientflashmat) 59 | 60 | 61 | class OBJECT_OT_generateGradientFlashPlane(bpy.types.Operator): 62 | """Create a linear gradient color plane""" 63 | bl_idname = "mesh.generate_gradient_flash_plane" 64 | bl_label = "Add a linear gradient color plane" 65 | bl_options = {'REGISTER', 'UNDO'} 66 | 67 | def execute(self, context): 68 | 69 | generateGradientFlashPlane() 70 | assignDrivers() 71 | 72 | return {'FINISHED'} 73 | -------------------------------------------------------------------------------- /GroundPlanes/Drivers/GrassPlaneDrivers.py: -------------------------------------------------------------------------------- 1 | # Assign Drivers to the Grass Plane 2 | 3 | import bpy 4 | 5 | def assignDrivers(): 6 | 7 | drivers = [] 8 | 9 | object = bpy.context.object 10 | 11 | # Color 1 - Red Channel 12 | d0 = { 13 | 'object': object, 14 | 'property': 'Color1', 15 | 'value': (0, 0.1, 0.04, 1), 16 | 'driven_value': 'nodes["ColorRamp"].color_ramp.elements[0].color', 17 | 'driven_object' : object.material_slots[0].material.node_tree, 18 | 'index' : 0, 19 | 'variable_name' : 'var', 20 | 'data_path' : '["Color1"][0]', 21 | 'id_type' : 'OBJECT', 22 | 'subtype': 'COLOR', 23 | 'min': 0, 24 | 'max': 1, 25 | } 26 | 27 | drivers.append(d0) 28 | 29 | # Color 1 - Green Channel 30 | d1 = { 31 | 'object': object, 32 | 'property': 'Color1', 33 | 'value': (0, 0.1, 0.04, 1), 34 | 'driven_value': 'nodes["ColorRamp"].color_ramp.elements[0].color', 35 | 'driven_object' : object.material_slots[0].material.node_tree, 36 | 'index' : 1, 37 | 'variable_name' : 'var', 38 | 'data_path' : '["Color1"][1]', 39 | 'id_type' : 'OBJECT', 40 | 'subtype': 'COLOR', 41 | 'min': 0, 42 | 'max': 1, 43 | } 44 | 45 | drivers.append(d1) 46 | 47 | # Color 1 - Blue Channel 48 | d2 = { 49 | 'object': object, 50 | 'property': 'Color1', 51 | 'value': (0, 0.1, 0.04, 1), 52 | 'driven_value': 'nodes["ColorRamp"].color_ramp.elements[0].color', 53 | 'driven_object' : object.material_slots[0].material.node_tree, 54 | 'index' : 2, 55 | 'variable_name' : 'var', 56 | 'data_path' : '["Color1"][2]', 57 | 'id_type' : 'OBJECT', 58 | 'subtype': 'COLOR', 59 | 'min': 0, 60 | 'max': 1, 61 | } 62 | 63 | drivers.append(d2) 64 | 65 | # Color 2 - Red Channel 66 | d3 = { 67 | 'object': object, 68 | 'property': 'Color2', 69 | 'value': (0, 0.5, 0.15, 1), 70 | 'driven_value': 'nodes["ColorRamp"].color_ramp.elements[1].color', 71 | 'driven_object' : object.material_slots[0].material.node_tree, 72 | 'index' : 0, 73 | 'variable_name' : 'var', 74 | 'data_path' : '["Color2"][0]', 75 | 'id_type' : 'OBJECT', 76 | 'subtype': 'COLOR', 77 | 'min': 0, 78 | 'max': 1, 79 | } 80 | 81 | drivers.append(d3) 82 | 83 | # Color 2 - Green Channel 84 | d4 = { 85 | 'object': object, 86 | 'property': 'Color2', 87 | 'value': (0, 0.5, 0.15, 1), 88 | 'driven_value': 'nodes["ColorRamp"].color_ramp.elements[1].color', 89 | 'driven_object' : object.material_slots[0].material.node_tree, 90 | 'index' : 1, 91 | 'variable_name' : 'var', 92 | 'data_path' : '["Color2"][1]', 93 | 'id_type' : 'OBJECT', 94 | 'subtype': 'COLOR', 95 | 'min': 0, 96 | 'max': 1, 97 | } 98 | 99 | drivers.append(d4) 100 | 101 | # Color 2 - Blue Channel 102 | d5 = { 103 | 'object': object, 104 | 'property': 'Color2', 105 | 'value': (0, 0.5, 0.15, 1), 106 | 'driven_value': 'nodes["ColorRamp"].color_ramp.elements[1].color', 107 | 'driven_object' : object.material_slots[0].material.node_tree, 108 | 'index' : 2, 109 | 'variable_name' : 'var', 110 | 'data_path' : '["Color2"][2]', 111 | 'id_type' : 'OBJECT', 112 | 'subtype': 'COLOR', 113 | 'min': 0, 114 | 'max': 1, 115 | } 116 | 117 | drivers.append(d5) 118 | 119 | # Array - X Count 120 | d6 = { 121 | 'object': object, 122 | 'property': 'ExtendX', 123 | 'value': 1, 124 | 'driven_value': 'count', 125 | 'driven_object' : object.modifiers['Array'], 126 | 'index' : -1, 127 | 'variable_name' : 'var', 128 | 'data_path' : '["ExtendX"]', 129 | 'id_type' : 'OBJECT', 130 | 'subtype': '', 131 | 'min': 0, 132 | 'max': 100, 133 | } 134 | 135 | drivers.append(d6) 136 | 137 | # Array - Y Count 138 | d7 = { 139 | 'object': object, 140 | 'property': 'ExtendY', 141 | 'value': 1, 142 | 'driven_value': 'count', 143 | 'driven_object' : object.modifiers['Array.001'], 144 | 'index' : -1, 145 | 'variable_name' : 'var', 146 | 'data_path' : '["ExtendY"]', 147 | 'id_type' : 'OBJECT', 148 | 'subtype': '', 149 | 'min': 0, 150 | 'max': 100, 151 | } 152 | 153 | drivers.append(d7) 154 | 155 | # Displace Strength 156 | d8 = { 157 | 'object': object, 158 | 'property': 'DisplaceStrength', 159 | 'value': 0.5, 160 | 'driven_value': 'strength', 161 | 'driven_object' : object.modifiers["Displace"], 162 | 'index' : -1, 163 | 'variable_name' : 'var', 164 | 'data_path' : '["DisplaceStrength"]', 165 | 'id_type' : 'OBJECT', 166 | 'subtype': '', 167 | 'min': 0, 168 | 'max': 100, 169 | } 170 | 171 | drivers.append(d8) 172 | 173 | # Grass Length 174 | d9 = { 175 | 'object': object, 176 | 'property': 'GrassLength', 177 | 'value': 0.2, 178 | 'driven_value': 'hair_length', 179 | 'driven_object' : bpy.data.particles["GrassParticleSettings"], 180 | 'index' : -1, 181 | 'variable_name' : 'var', 182 | 'data_path' : '["GrassLength"]', 183 | 'id_type' : 'OBJECT', 184 | 'subtype': '', 185 | 'min': 0, 186 | 'max': 100, 187 | } 188 | 189 | drivers.append(d9) 190 | 191 | # Render Children 192 | d10 = { 193 | 'object': object, 194 | 'property': 'RenderMultiplier', 195 | 'value': 100, 196 | 'driven_value': 'rendered_child_count', 197 | 'driven_object' : bpy.data.particles["GrassParticleSettings"], 198 | 'index' : -1, 199 | 'variable_name' : 'var', 200 | 'data_path' : '["RenderMultiplier"]', 201 | 'id_type' : 'OBJECT', 202 | 'subtype': '', 203 | 'min': 0, 204 | 'max': 1000, 205 | } 206 | 207 | drivers.append(d10) 208 | 209 | # Twist 210 | d11 = { 211 | 'object': object, 212 | 'property': 'Twist', 213 | 'value': 0.0, 214 | 'driven_value': 'twist', 215 | 'driven_object' : bpy.data.particles["GrassParticleSettings"], 216 | 'index' : -1, 217 | 'variable_name' : 'var', 218 | 'data_path' : '["Twist"]', 219 | 'id_type' : 'OBJECT', 220 | 'subtype': '', 221 | 'min': -10, 222 | 'max': 10, 223 | } 224 | 225 | drivers.append(d11) 226 | 227 | # Displace Scale 228 | d12 = { 229 | 'object': object, 230 | 'property': 'DisplaceScale', 231 | 'value': 0.25, 232 | 'driven_value': 'noise_scale', 233 | 'driven_object' : bpy.data.textures["GrassTexture"], 234 | 'index' : -1, 235 | 'variable_name' : 'var', 236 | 'data_path' : '["DisplaceScale"]', 237 | 'id_type' : 'OBJECT', 238 | 'subtype': '', 239 | 'min': 0, 240 | 'max': 2, 241 | } 242 | 243 | drivers.append(d12) 244 | 245 | # Color 1 - Position 246 | d13 = { 247 | 'object': object, 248 | 'property': 'Color1Position', 249 | 'value': 0.0, 250 | 'driven_value': 'nodes["ColorRamp"].color_ramp.elements[0].position', 251 | 'driven_object' : object.material_slots[0].material.node_tree, 252 | 'index' : -1, 253 | 'variable_name' : 'var', 254 | 'data_path' : '["Color1Position"]', 255 | 'id_type' : 'OBJECT', 256 | 'subtype': '', 257 | 'min': 0, 258 | 'max': 1, 259 | } 260 | 261 | drivers.append(d13) 262 | 263 | # Color 2 - Position 264 | d14 = { 265 | 'object': object, 266 | 'property': 'Color2Position', 267 | 'value': 1.0, 268 | 'driven_value': 'nodes["ColorRamp"].color_ramp.elements[1].position', 269 | 'driven_object' : object.material_slots[0].material.node_tree, 270 | 'index' : -1, 271 | 'variable_name' : 'var', 272 | 'data_path' : '["Color2Position"]', 273 | 'id_type' : 'OBJECT', 274 | 'subtype': '', 275 | 'min': 0, 276 | 'max': 1, 277 | } 278 | 279 | drivers.append(d14) 280 | 281 | 282 | for d in drivers: 283 | d['object'][d['property']] = d['value'] 284 | 285 | edit_property = d['object'].id_properties_ui(d['property']) 286 | edit_property.update(min=d['min'], max=d['max']) 287 | 288 | if d['subtype']: 289 | edit_property.update(subtype=d['subtype']) 290 | 291 | driver = d['driven_object'].driver_add(d['driven_value'], d['index']) 292 | 293 | variable = driver.driver.variables.new() 294 | variable.name = d['variable_name'] 295 | variable.targets[0].id_type = d['id_type'] 296 | variable.targets[0].id = d['object'] 297 | variable.targets[0].data_path = d['data_path'] 298 | 299 | driver.driver.expression = variable.name 300 | 301 | # Update Driver Dependencies 302 | d['object'].hide_render = d['object'].hide_render 303 | -------------------------------------------------------------------------------- /GroundPlanes/Drivers/IcePlaneDrivers.py: -------------------------------------------------------------------------------- 1 | # Assign Drivers to the Ice Plane 2 | 3 | import bpy 4 | 5 | def assignDrivers(): 6 | 7 | drivers = [] 8 | 9 | object = bpy.context.object 10 | 11 | # Color 1 - Red Channel 12 | d0 = { 13 | 'object': object, 14 | 'property': 'Color1', 15 | 'value': [0.094031, 0.292350, 0.604645, 1.000000], 16 | 'driven_value': 'nodes["ColorRamp"].color_ramp.elements[0].color', 17 | 'driven_object' : object.material_slots[0].material.node_tree, 18 | 'index' : 0, 19 | 'variable_name' : 'var', 20 | 'data_path' : '["Color1"][0]', 21 | 'id_type' : 'OBJECT', 22 | 'subtype': 'COLOR', 23 | 'min': 0, 24 | 'max': 1, 25 | } 26 | 27 | drivers.append(d0) 28 | 29 | # Color 1 - Green Channel 30 | d1 = { 31 | 'object': object, 32 | 'property': 'Color1', 33 | 'value': [0.094031, 0.292350, 0.604645, 1.000000], 34 | 'driven_value': 'nodes["ColorRamp"].color_ramp.elements[0].color', 35 | 'driven_object' : object.material_slots[0].material.node_tree, 36 | 'index' : 1, 37 | 'variable_name' : 'var', 38 | 'data_path' : '["Color1"][1]', 39 | 'id_type' : 'OBJECT', 40 | 'subtype': 'COLOR', 41 | 'min': 0, 42 | 'max': 1, 43 | } 44 | 45 | drivers.append(d1) 46 | 47 | # Color 1 - Blue Channel 48 | d2 = { 49 | 'object': object, 50 | 'property': 'Color1', 51 | 'value': [0.094031, 0.292350, 0.604645, 1.000000], 52 | 'driven_value': 'nodes["ColorRamp"].color_ramp.elements[0].color', 53 | 'driven_object' : object.material_slots[0].material.node_tree, 54 | 'index' : 2, 55 | 'variable_name' : 'var', 56 | 'data_path' : '["Color1"][2]', 57 | 'id_type' : 'OBJECT', 58 | 'subtype': 'COLOR', 59 | 'min': 0, 60 | 'max': 1, 61 | } 62 | 63 | drivers.append(d2) 64 | 65 | # Color 2 - Red Channel 66 | d3 = { 67 | 'object': object, 68 | 'property': 'Color2', 69 | 'value': [0.211978, 0.482632, 0.818554, 1.000000], 70 | 'driven_value': 'nodes["ColorRamp"].color_ramp.elements[1].color', 71 | 'driven_object' : object.material_slots[0].material.node_tree, 72 | 'index' : 0, 73 | 'variable_name' : 'var', 74 | 'data_path' : '["Color2"][0]', 75 | 'id_type' : 'OBJECT', 76 | 'subtype': 'COLOR', 77 | 'min': 0, 78 | 'max': 1, 79 | } 80 | 81 | drivers.append(d3) 82 | 83 | # Color 2 - Green Channel 84 | d4 = { 85 | 'object': object, 86 | 'property': 'Color2', 87 | 'value': [0.211978, 0.482632, 0.818554, 1.000000], 88 | 'driven_value': 'nodes["ColorRamp"].color_ramp.elements[1].color', 89 | 'driven_object' : object.material_slots[0].material.node_tree, 90 | 'index' : 1, 91 | 'variable_name' : 'var', 92 | 'data_path' : '["Color2"][1]', 93 | 'id_type' : 'OBJECT', 94 | 'subtype': 'COLOR', 95 | 'min': 0, 96 | 'max': 1, 97 | } 98 | 99 | drivers.append(d4) 100 | 101 | # Color 2 - Blue Channel 102 | d5 = { 103 | 'object': object, 104 | 'property': 'Color2', 105 | 'value': [0.211978, 0.482632, 0.818554, 1.000000], 106 | 'driven_value': 'nodes["ColorRamp"].color_ramp.elements[1].color', 107 | 'driven_object' : object.material_slots[0].material.node_tree, 108 | 'index' : 2, 109 | 'variable_name' : 'var', 110 | 'data_path' : '["Color2"][2]', 111 | 'id_type' : 'OBJECT', 112 | 'subtype': 'COLOR', 113 | 'min': 0, 114 | 'max': 1, 115 | } 116 | 117 | drivers.append(d5) 118 | 119 | # Color 3 - Red Channel 120 | d6 = { 121 | 'object': object, 122 | 'property': 'Color3', 123 | 'value': [1.000000, 1.000000, 1.000000, 1.000000], 124 | 'driven_value': 'nodes["ColorRamp"].color_ramp.elements[2].color', 125 | 'driven_object' : object.material_slots[0].material.node_tree, 126 | 'index' : 0, 127 | 'variable_name' : 'var', 128 | 'data_path' : '["Color3"][0]', 129 | 'id_type' : 'OBJECT', 130 | 'subtype': 'COLOR', 131 | 'min': 0, 132 | 'max': 1, 133 | } 134 | 135 | drivers.append(d6) 136 | 137 | # Color 3 - Green Channel 138 | d7 = { 139 | 'object': object, 140 | 'property': 'Color3', 141 | 'value': [1.000000, 1.000000, 1.000000, 1.000000], 142 | 'driven_value': 'nodes["ColorRamp"].color_ramp.elements[2].color', 143 | 'driven_object' : object.material_slots[0].material.node_tree, 144 | 'index' : 1, 145 | 'variable_name' : 'var', 146 | 'data_path' : '["Color3"][1]', 147 | 'id_type' : 'OBJECT', 148 | 'subtype': 'COLOR', 149 | 'min': 0, 150 | 'max': 1, 151 | } 152 | 153 | drivers.append(d7) 154 | 155 | # Color 3 - Blue Channel 156 | d8 = { 157 | 'object': object, 158 | 'property': 'Color3', 159 | 'value': [1.000000, 1.000000, 1.000000, 1.000000], 160 | 'driven_value': 'nodes["ColorRamp"].color_ramp.elements[2].color', 161 | 'driven_object' : object.material_slots[0].material.node_tree, 162 | 'index' : 2, 163 | 'variable_name' : 'var', 164 | 'data_path' : '["Color3"][2]', 165 | 'id_type' : 'OBJECT', 166 | 'subtype': 'COLOR', 167 | 'min': 0, 168 | 'max': 1, 169 | } 170 | 171 | drivers.append(d8) 172 | 173 | # Tint Color - Red Channel 174 | d9 = { 175 | 'object': object, 176 | 'property': 'ColorTint', 177 | 'value': [0.183718, 0.330284, 0.800000, 1.000000], 178 | 'driven_value': 'nodes["Translucent BSDF"].inputs[0].default_value', 179 | 'driven_object' : object.material_slots[0].material.node_tree, 180 | 'index' : 0, 181 | 'variable_name' : 'var', 182 | 'data_path' : '["ColorTint"][0]', 183 | 'id_type' : 'OBJECT', 184 | 'subtype': 'COLOR', 185 | 'min': 0, 186 | 'max': 1, 187 | } 188 | 189 | drivers.append(d9) 190 | 191 | # Tint Color - Green Channel 192 | d10 = { 193 | 'object': object, 194 | 'property': 'ColorTint', 195 | 'value': [0.183718, 0.330284, 0.800000, 1.000000], 196 | 'driven_value': 'nodes["Translucent BSDF"].inputs[0].default_value', 197 | 'driven_object' : object.material_slots[0].material.node_tree, 198 | 'index' : 1, 199 | 'variable_name' : 'var', 200 | 'data_path' : '["ColorTint"][1]', 201 | 'id_type' : 'OBJECT', 202 | 'subtype': 'COLOR', 203 | 'min': 0, 204 | 'max': 1, 205 | } 206 | 207 | drivers.append(d10) 208 | 209 | # Tint Color - Blue Channel 210 | d11 = { 211 | 'object': object, 212 | 'property': 'ColorTint', 213 | 'value': [0.183718, 0.330284, 0.800000, 1.000000], 214 | 'driven_value': 'nodes["Translucent BSDF"].inputs[0].default_value', 215 | 'driven_object' : object.material_slots[0].material.node_tree, 216 | 'index' : 2, 217 | 'variable_name' : 'var', 218 | 'data_path' : '["ColorTint"][2]', 219 | 'id_type' : 'OBJECT', 220 | 'subtype': 'COLOR', 221 | 'min': 0, 222 | 'max': 1, 223 | } 224 | 225 | drivers.append(d11) 226 | 227 | # Extend X 228 | d18 = { 229 | 'object': object, 230 | 'property': 'ExtendX', 231 | 'value': 1, 232 | 'driven_value': 'count', 233 | 'driven_object' : object.modifiers['Array'], 234 | 'index' : -1, 235 | 'variable_name' : 'var', 236 | 'data_path' : '["ExtendX"]', 237 | 'id_type' : 'OBJECT', 238 | 'subtype': '', 239 | 'min': 0, 240 | 'max': 100, 241 | } 242 | 243 | drivers.append(d18) 244 | 245 | # Extend Y 246 | d19 = { 247 | 'object': object, 248 | 'property': 'ExtendY', 249 | 'value': 1, 250 | 'driven_value': 'count', 251 | 'driven_object' : object.modifiers['Array.001'], 252 | 'index' : -1, 253 | 'variable_name' : 'var', 254 | 'data_path' : '["ExtendY"]', 255 | 'id_type' : 'OBJECT', 256 | 'subtype': '', 257 | 'min': 0, 258 | 'max': 100, 259 | } 260 | 261 | drivers.append(d19) 262 | 263 | # CracksMix1 264 | d20 = { 265 | 'object': object, 266 | 'property': 'CracksMix1', 267 | 'value': 0.141, 268 | 'driven_value': 'nodes["ColorRamp.001"].color_ramp.elements[0].position', 269 | 'driven_object' : object.material_slots[0].material.node_tree, 270 | 'index' : -1, 271 | 'variable_name' : 'var', 272 | 'data_path' : '["CracksMix1"]', 273 | 'id_type' : 'OBJECT', 274 | 'subtype': '', 275 | 'min': 0, 276 | 'max': 1, 277 | } 278 | 279 | drivers.append(d20) 280 | 281 | # Lines Mix 282 | d21 = { 283 | 'object': object, 284 | 'property': 'LinesMix', 285 | 'value': 1.0, 286 | 'driven_value': 'nodes["Mix"].inputs[0].default_value', 287 | 'driven_object' : object.material_slots[0].material.node_tree, 288 | 'index' : -1, 289 | 'variable_name' : 'var', 290 | 'data_path' : '["LinesMix"]', 291 | 'id_type' : 'OBJECT', 292 | 'subtype': '', 293 | 'min': 0, 294 | 'max': 1, 295 | } 296 | 297 | drivers.append(d21) 298 | 299 | # Noise 1 Scale 300 | d22 = { 301 | 'object': object, 302 | 'property': 'Noise1Scale', 303 | 'value': 1.0, 304 | 'driven_value': 'nodes["Noise Texture"].inputs[2].default_value', 305 | 'driven_object' : object.material_slots[0].material.node_tree, 306 | 'index' : -1, 307 | 'variable_name' : 'var', 308 | 'data_path' : '["Noise1Scale"]', 309 | 'id_type' : 'OBJECT', 310 | 'subtype': '', 311 | 'min': -100, 312 | 'max': 100, 313 | } 314 | 315 | drivers.append(d22) 316 | 317 | # Noise 2 Scale 318 | d23 = { 319 | 'object': object, 320 | 'property': 'Noise2Scale', 321 | 'value': 10.0, 322 | 'driven_value': 'nodes["Voronoi Texture"].inputs[2].default_value', 323 | 'driven_object' : object.material_slots[0].material.node_tree, 324 | 'index' : -1, 325 | 'variable_name' : 'var', 326 | 'data_path' : '["Noise2Scale"]', 327 | 'id_type' : 'OBJECT', 328 | 'subtype': '', 329 | 'min': -100, 330 | 'max': 100, 331 | } 332 | 333 | drivers.append(d23) 334 | 335 | # Displace Strength 336 | d24 = { 337 | 'object': object, 338 | 'property': 'DisplaceStrength', 339 | 'value': 0.01, 340 | 'driven_value': 'strength', 341 | 'driven_object' : object.modifiers["Displace"], 342 | 'index' : -1, 343 | 'variable_name' : 'var', 344 | 'data_path' : '["DisplaceStrength"]', 345 | 'id_type' : 'OBJECT', 346 | 'subtype': '', 347 | 'min': 0, 348 | 'max': 10, 349 | } 350 | 351 | drivers.append(d24) 352 | 353 | # CracksMix2 354 | d25 = { 355 | 'object': object, 356 | 'property': 'CracksMix2', 357 | 'value': 0.4, 358 | 'driven_value': 'nodes["ColorRamp.001"].color_ramp.elements[1].position', 359 | 'driven_object' : object.material_slots[0].material.node_tree, 360 | 'index' : -1, 361 | 'variable_name' : 'var', 362 | 'data_path' : '["CracksMix2"]', 363 | 'id_type' : 'OBJECT', 364 | 'subtype': '', 365 | 'min': 0, 366 | 'max': 1, 367 | } 368 | 369 | drivers.append(d25) 370 | 371 | for d in drivers: 372 | d['object'][d['property']] = d['value'] 373 | 374 | edit_property = d['object'].id_properties_ui(d['property']) 375 | edit_property.update(min=d['min'], max=d['max']) 376 | 377 | if d['subtype']: 378 | edit_property.update(subtype=d['subtype']) 379 | 380 | driver = d['driven_object'].driver_add(d['driven_value'], d['index']) 381 | 382 | variable = driver.driver.variables.new() 383 | variable.name = d['variable_name'] 384 | variable.targets[0].id_type = d['id_type'] 385 | variable.targets[0].id = d['object'] 386 | variable.targets[0].data_path = d['data_path'] 387 | 388 | driver.driver.expression = variable.name 389 | 390 | # Update Driver Dependencies 391 | d['object'].hide_render = d['object'].hide_render 392 | -------------------------------------------------------------------------------- /GroundPlanes/Drivers/RockWallPlaneDrivers.py: -------------------------------------------------------------------------------- 1 | # Assign Drivers to the Rock Wall Plane 2 | 3 | import bpy 4 | 5 | def assignDrivers(): 6 | 7 | drivers = [] 8 | 9 | object = bpy.context.object 10 | 11 | # Color 1 - Red Channel 12 | d0 = { 13 | 'object': object, 14 | 'property': 'Color1', 15 | 'value': [0.010113, 0.006843, 0.002995, 1.000000], 16 | 'driven_value': 'nodes["ColorRamp"].color_ramp.elements[0].color', 17 | 'driven_object' : object.material_slots[0].material.node_tree, 18 | 'index' : 0, 19 | 'variable_name' : 'var', 20 | 'data_path' : '["Color1"][0]', 21 | 'id_type' : 'OBJECT', 22 | 'subtype': 'COLOR', 23 | 'min': 0, 24 | 'max': 1, 25 | } 26 | 27 | drivers.append(d0) 28 | 29 | # Color 1 - Green Channel 30 | d1 = { 31 | 'object': object, 32 | 'property': 'Color1', 33 | 'value': [0.010113, 0.006843, 0.002995, 1.000000], 34 | 'driven_value': 'nodes["ColorRamp"].color_ramp.elements[0].color', 35 | 'driven_object' : object.material_slots[0].material.node_tree, 36 | 'index' : 1, 37 | 'variable_name' : 'var', 38 | 'data_path' : '["Color1"][1]', 39 | 'id_type' : 'OBJECT', 40 | 'subtype': 'COLOR', 41 | 'min': 0, 42 | 'max': 1, 43 | } 44 | 45 | drivers.append(d1) 46 | 47 | # Color 1 - Blue Channel 48 | d2 = { 49 | 'object': object, 50 | 'property': 'Color1', 51 | 'value': [0.010113, 0.006843, 0.002995, 1.000000], 52 | 'driven_value': 'nodes["ColorRamp"].color_ramp.elements[0].color', 53 | 'driven_object' : object.material_slots[0].material.node_tree, 54 | 'index' : 2, 55 | 'variable_name' : 'var', 56 | 'data_path' : '["Color1"][2]', 57 | 'id_type' : 'OBJECT', 58 | 'subtype': 'COLOR', 59 | 'min': 0, 60 | 'max': 1, 61 | } 62 | 63 | drivers.append(d2) 64 | 65 | # Color 2 - Red Channel 66 | d3 = { 67 | 'object': object, 68 | 'property': 'Color2', 69 | 'value': [0.076728, 0.045395, 0.013369, 1.000000], 70 | 'driven_value': 'nodes["ColorRamp"].color_ramp.elements[1].color', 71 | 'driven_object' : object.material_slots[0].material.node_tree, 72 | 'index' : 0, 73 | 'variable_name' : 'var', 74 | 'data_path' : '["Color2"][0]', 75 | 'id_type' : 'OBJECT', 76 | 'subtype': 'COLOR', 77 | 'min': 0, 78 | 'max': 1, 79 | } 80 | 81 | drivers.append(d3) 82 | 83 | # Color 2 - Green Channel 84 | d4 = { 85 | 'object': object, 86 | 'property': 'Color2', 87 | 'value': [0.076728, 0.045395, 0.013369, 1.000000], 88 | 'driven_value': 'nodes["ColorRamp"].color_ramp.elements[1].color', 89 | 'driven_object' : object.material_slots[0].material.node_tree, 90 | 'index' : 1, 91 | 'variable_name' : 'var', 92 | 'data_path' : '["Color2"][1]', 93 | 'id_type' : 'OBJECT', 94 | 'subtype': 'COLOR', 95 | 'min': 0, 96 | 'max': 1, 97 | } 98 | 99 | drivers.append(d4) 100 | 101 | # Color 2 - Blue Channel 102 | d5 = { 103 | 'object': object, 104 | 'property': 'Color2', 105 | 'value': [0.076728, 0.045395, 0.013369, 1.000000], 106 | 'driven_value': 'nodes["ColorRamp"].color_ramp.elements[1].color', 107 | 'driven_object' : object.material_slots[0].material.node_tree, 108 | 'index' : 2, 109 | 'variable_name' : 'var', 110 | 'data_path' : '["Color2"][2]', 111 | 'id_type' : 'OBJECT', 112 | 'subtype': 'COLOR', 113 | 'min': 0, 114 | 'max': 1, 115 | } 116 | 117 | drivers.append(d5) 118 | 119 | # Color 3 - Red Channel 120 | d6 = { 121 | 'object': object, 122 | 'property': 'Color3', 123 | 'value': [0.571661, 0.423131, 0.123842, 1.000000], 124 | 'driven_value': 'nodes["ColorRamp"].color_ramp.elements[2].color', 125 | 'driven_object' : object.material_slots[0].material.node_tree, 126 | 'index' : 0, 127 | 'variable_name' : 'var', 128 | 'data_path' : '["Color3"][0]', 129 | 'id_type' : 'OBJECT', 130 | 'subtype': 'COLOR', 131 | 'min': 0, 132 | 'max': 1, 133 | } 134 | 135 | drivers.append(d6) 136 | 137 | # Color 3 - Green Channel 138 | d7 = { 139 | 'object': object, 140 | 'property': 'Color3', 141 | 'value': [0.571661, 0.423131, 0.123842, 1.000000], 142 | 'driven_value': 'nodes["ColorRamp"].color_ramp.elements[2].color', 143 | 'driven_object' : object.material_slots[0].material.node_tree, 144 | 'index' : 1, 145 | 'variable_name' : 'var', 146 | 'data_path' : '["Color3"][1]', 147 | 'id_type' : 'OBJECT', 148 | 'subtype': 'COLOR', 149 | 'min': 0, 150 | 'max': 1, 151 | } 152 | 153 | drivers.append(d7) 154 | 155 | # Color 3 - Blue Channel 156 | d8 = { 157 | 'object': object, 158 | 'property': 'Color3', 159 | 'value': [0.571661, 0.423131, 0.123842, 1.000000], 160 | 'driven_value': 'nodes["ColorRamp"].color_ramp.elements[2].color', 161 | 'driven_object' : object.material_slots[0].material.node_tree, 162 | 'index' : 2, 163 | 'variable_name' : 'var', 164 | 'data_path' : '["Color3"][2]', 165 | 'id_type' : 'OBJECT', 166 | 'subtype': 'COLOR', 167 | 'min': 0, 168 | 'max': 1, 169 | } 170 | 171 | drivers.append(d8) 172 | 173 | # Extend X 174 | d18 = { 175 | 'object': object, 176 | 'property': 'ExtendX', 177 | 'value': 1, 178 | 'driven_value': 'count', 179 | 'driven_object' : object.modifiers['Array'], 180 | 'index' : -1, 181 | 'variable_name' : 'var', 182 | 'data_path' : '["ExtendX"]', 183 | 'id_type' : 'OBJECT', 184 | 'subtype': '', 185 | 'min': 0, 186 | 'max': 100, 187 | } 188 | 189 | drivers.append(d18) 190 | 191 | # Extend Y 192 | d19 = { 193 | 'object': object, 194 | 'property': 'ExtendY', 195 | 'value': 1, 196 | 'driven_value': 'count', 197 | 'driven_object' : object.modifiers['Array.001'], 198 | 'index' : -1, 199 | 'variable_name' : 'var', 200 | 'data_path' : '["ExtendY"]', 201 | 'id_type' : 'OBJECT', 202 | 'subtype': '', 203 | 'min': 0, 204 | 'max': 100, 205 | } 206 | 207 | drivers.append(d19) 208 | 209 | # Bump Strength 210 | d20 = { 211 | 'object': object, 212 | 'property': 'BumpStrength', 213 | 'value': 0.01, 214 | 'driven_value': 'nodes["Bump"].inputs[0].default_value', 215 | 'driven_object' : object.material_slots[0].material.node_tree, 216 | 'index' : -1, 217 | 'variable_name' : 'var', 218 | 'data_path' : '["BumpStrength"]', 219 | 'id_type' : 'OBJECT', 220 | 'subtype': '', 221 | 'min': 0, 222 | 'max': 100, 223 | } 224 | 225 | drivers.append(d20) 226 | 227 | # Shadow Mix 228 | d21 = { 229 | 'object': object, 230 | 'property': 'ShadowMix', 231 | 'value': 1.0, 232 | 'driven_value': 'nodes["Mix"].inputs[0].default_value', 233 | 'driven_object' : object.material_slots[0].material.node_tree, 234 | 'index' : -1, 235 | 'variable_name' : 'var', 236 | 'data_path' : '["ShadowMix"]', 237 | 'id_type' : 'OBJECT', 238 | 'subtype': '', 239 | 'min': 0, 240 | 'max': 1, 241 | } 242 | 243 | drivers.append(d21) 244 | 245 | # Noise Scale 246 | d22 = { 247 | 'object': object, 248 | 'property': 'NoiseScale', 249 | 'value': 10.0, 250 | 'driven_value': 'nodes["Noise Texture"].inputs[2].default_value', 251 | 'driven_object' : object.material_slots[0].material.node_tree, 252 | 'index' : -1, 253 | 'variable_name' : 'var', 254 | 'data_path' : '["NoiseScale"]', 255 | 'id_type' : 'OBJECT', 256 | 'subtype': '', 257 | 'min': -100, 258 | 'max': 100, 259 | } 260 | 261 | drivers.append(d22) 262 | 263 | # Rock Scale 264 | d23 = { 265 | 'object': object, 266 | 'property': 'RockScale', 267 | 'value': 3.0, 268 | 'driven_value': 'nodes["Voronoi Texture"].inputs[2].default_value', 269 | 'driven_object' : object.material_slots[0].material.node_tree, 270 | 'index' : -1, 271 | 'variable_name' : 'var', 272 | 'data_path' : '["RockScale"]', 273 | 'id_type' : 'OBJECT', 274 | 'subtype': '', 275 | 'min': 0, 276 | 'max': 1000, 277 | } 278 | 279 | drivers.append(d23) 280 | 281 | # Distortion Scale 282 | d24 = { 283 | 'object': object, 284 | 'property': 'DistortionScale', 285 | 'value': 1.0, 286 | 'driven_value': 'nodes["Noise Texture.001"].inputs[2].default_value', 287 | 'driven_object' : object.material_slots[0].material.node_tree, 288 | 'index' : -1, 289 | 'variable_name' : 'var', 290 | 'data_path' : '["DistortionScale"]', 291 | 'id_type' : 'OBJECT', 292 | 'subtype': '', 293 | 'min': 0, 294 | 'max': 10, 295 | } 296 | 297 | drivers.append(d24) 298 | 299 | for d in drivers: 300 | d['object'][d['property']] = d['value'] 301 | 302 | edit_property = d['object'].id_properties_ui(d['property']) 303 | edit_property.update(min=d['min'], max=d['max']) 304 | 305 | if d['subtype']: 306 | edit_property.update(subtype=d['subtype']) 307 | 308 | driver = d['driven_object'].driver_add(d['driven_value'], d['index']) 309 | 310 | variable = driver.driver.variables.new() 311 | variable.name = d['variable_name'] 312 | variable.targets[0].id_type = d['id_type'] 313 | variable.targets[0].id = d['object'] 314 | variable.targets[0].data_path = d['data_path'] 315 | 316 | driver.driver.expression = variable.name 317 | 318 | # Update Driver Dependencies 319 | d['object'].hide_render = d['object'].hide_render 320 | -------------------------------------------------------------------------------- /GroundPlanes/Drivers/SandPlaneDrivers.py: -------------------------------------------------------------------------------- 1 | # Assign Drivers to the Ice Plane 2 | 3 | import bpy 4 | 5 | def assignDrivers(): 6 | 7 | drivers = [] 8 | 9 | object = bpy.context.object 10 | 11 | # Color 1 - Red Channel 12 | d0 = { 13 | 'object': object, 14 | 'property': 'Color1', 15 | 'value': [0.273416, 0.222385, 0.073390, 1.000000], 16 | 'driven_value': 'nodes["ColorRamp"].color_ramp.elements[0].color', 17 | 'driven_object' : object.material_slots[0].material.node_tree, 18 | 'index' : 0, 19 | 'variable_name' : 'var', 20 | 'data_path' : '["Color1"][0]', 21 | 'id_type' : 'OBJECT', 22 | 'subtype': 'COLOR', 23 | 'min': 0, 24 | 'max': 1, 25 | } 26 | 27 | drivers.append(d0) 28 | 29 | # Color 1 - Green Channel 30 | d1 = { 31 | 'object': object, 32 | 'property': 'Color1', 33 | 'value': [0.273416, 0.222385, 0.073390, 1.000000], 34 | 'driven_value': 'nodes["ColorRamp"].color_ramp.elements[0].color', 35 | 'driven_object' : object.material_slots[0].material.node_tree, 36 | 'index' : 1, 37 | 'variable_name' : 'var', 38 | 'data_path' : '["Color1"][1]', 39 | 'id_type' : 'OBJECT', 40 | 'subtype': 'COLOR', 41 | 'min': 0, 42 | 'max': 1, 43 | } 44 | 45 | drivers.append(d1) 46 | 47 | # Color 1 - Blue Channel 48 | d2 = { 49 | 'object': object, 50 | 'property': 'Color1', 51 | 'value': [0.273416, 0.222385, 0.073390, 1.000000], 52 | 'driven_value': 'nodes["ColorRamp"].color_ramp.elements[0].color', 53 | 'driven_object' : object.material_slots[0].material.node_tree, 54 | 'index' : 2, 55 | 'variable_name' : 'var', 56 | 'data_path' : '["Color1"][2]', 57 | 'id_type' : 'OBJECT', 58 | 'subtype': 'COLOR', 59 | 'min': 0, 60 | 'max': 1, 61 | } 62 | 63 | drivers.append(d2) 64 | 65 | # Color 2 - Red Channel 66 | d3 = { 67 | 'object': object, 68 | 'property': 'Color2', 69 | 'value': [0.641803, 0.656629, 0.100958, 1.000000], 70 | 'driven_value': 'nodes["ColorRamp"].color_ramp.elements[1].color', 71 | 'driven_object' : object.material_slots[0].material.node_tree, 72 | 'index' : 0, 73 | 'variable_name' : 'var', 74 | 'data_path' : '["Color2"][0]', 75 | 'id_type' : 'OBJECT', 76 | 'subtype': 'COLOR', 77 | 'min': 0, 78 | 'max': 1, 79 | } 80 | 81 | drivers.append(d3) 82 | 83 | # Color 2 - Green Channel 84 | d4 = { 85 | 'object': object, 86 | 'property': 'Color2', 87 | 'value': [0.641803, 0.656629, 0.100958, 1.000000], 88 | 'driven_value': 'nodes["ColorRamp"].color_ramp.elements[1].color', 89 | 'driven_object' : object.material_slots[0].material.node_tree, 90 | 'index' : 1, 91 | 'variable_name' : 'var', 92 | 'data_path' : '["Color2"][1]', 93 | 'id_type' : 'OBJECT', 94 | 'subtype': 'COLOR', 95 | 'min': 0, 96 | 'max': 1, 97 | } 98 | 99 | drivers.append(d4) 100 | 101 | # Color 2 - Blue Channel 102 | d5 = { 103 | 'object': object, 104 | 'property': 'Color2', 105 | 'value': [0.641803, 0.656629, 0.100958, 1.000000], 106 | 'driven_value': 'nodes["ColorRamp"].color_ramp.elements[1].color', 107 | 'driven_object' : object.material_slots[0].material.node_tree, 108 | 'index' : 2, 109 | 'variable_name' : 'var', 110 | 'data_path' : '["Color2"][2]', 111 | 'id_type' : 'OBJECT', 112 | 'subtype': 'COLOR', 113 | 'min': 0, 114 | 'max': 1, 115 | } 116 | 117 | drivers.append(d5) 118 | 119 | # GrainsDensity 120 | d20 = { 121 | 'object': object, 122 | 'property': 'GrainsDensity', 123 | 'value': 0.86, 124 | 'driven_value': 'nodes["ColorRamp.001"].color_ramp.elements[1].position', 125 | 'driven_object' : object.material_slots[0].material.node_tree, 126 | 'index' : -1, 127 | 'variable_name' : 'var', 128 | 'data_path' : '["GrainsDensity"]', 129 | 'id_type' : 'OBJECT', 130 | 'subtype': '', 131 | 'min': 0, 132 | 'max': 1, 133 | } 134 | 135 | drivers.append(d20) 136 | 137 | # Grains Mix 138 | d21 = { 139 | 'object': object, 140 | 'property': 'GrainsMix', 141 | 'value': 1.0, 142 | 'driven_value': 'nodes["Mix"].inputs[0].default_value', 143 | 'driven_object' : object.material_slots[0].material.node_tree, 144 | 'index' : -1, 145 | 'variable_name' : 'var', 146 | 'data_path' : '["GrainsMix"]', 147 | 'id_type' : 'OBJECT', 148 | 'subtype': '', 149 | 'min': 0, 150 | 'max': 1, 151 | } 152 | 153 | drivers.append(d21) 154 | 155 | # Grain Scale 156 | d22 = { 157 | 'object': object, 158 | 'property': 'GrainScale', 159 | 'value': 1000.0, 160 | 'driven_value': 'nodes["Noise Texture"].inputs[2].default_value', 161 | 'driven_object' : object.material_slots[0].material.node_tree, 162 | 'index' : -1, 163 | 'variable_name' : 'var', 164 | 'data_path' : '["GrainScale"]', 165 | 'id_type' : 'OBJECT', 166 | 'subtype': '', 167 | 'min': -1000, 168 | 'max': 1000, 169 | } 170 | 171 | drivers.append(d22) 172 | 173 | # Displace Strength 174 | d24 = { 175 | 'object': object, 176 | 'property': 'DisplaceStrength', 177 | 'value': 0.5, 178 | 'driven_value': 'strength', 179 | 'driven_object' : object.modifiers["Displace"], 180 | 'index' : -1, 181 | 'variable_name' : 'var', 182 | 'data_path' : '["DisplaceStrength"]', 183 | 'id_type' : 'OBJECT', 184 | 'subtype': '', 185 | 'min': 0, 186 | 'max': 10, 187 | } 188 | 189 | drivers.append(d24) 190 | 191 | 192 | for d in drivers: 193 | d['object'][d['property']] = d['value'] 194 | 195 | edit_property = d['object'].id_properties_ui(d['property']) 196 | edit_property.update(min=d['min'], max=d['max']) 197 | 198 | if d['subtype']: 199 | edit_property.update(subtype=d['subtype']) 200 | 201 | driver = d['driven_object'].driver_add(d['driven_value'], d['index']) 202 | 203 | variable = driver.driver.variables.new() 204 | variable.name = d['variable_name'] 205 | variable.targets[0].id_type = d['id_type'] 206 | variable.targets[0].id = d['object'] 207 | variable.targets[0].data_path = d['data_path'] 208 | 209 | driver.driver.expression = variable.name 210 | 211 | # Update Driver Dependencies 212 | d['object'].hide_render = d['object'].hide_render 213 | -------------------------------------------------------------------------------- /GroundPlanes/Drivers/StonePathPlaneDrivers.py: -------------------------------------------------------------------------------- 1 | # Assign Drivers to the Stone Path Plane 2 | 3 | import bpy 4 | 5 | def assignDrivers(): 6 | 7 | drivers = [] 8 | 9 | object = bpy.context.object 10 | 11 | # Color 1 - Red Channel 12 | d0 = { 13 | 'object': object, 14 | 'property': 'Color1', 15 | 'value': [0.016370, 0.068727, 0.016674, 1.000000], 16 | 'driven_value': 'nodes["ColorRamp"].color_ramp.elements[0].color', 17 | 'driven_object' : object.material_slots[0].material.node_tree, 18 | 'index' : 0, 19 | 'variable_name' : 'var', 20 | 'data_path' : '["Color1"][0]', 21 | 'id_type' : 'OBJECT', 22 | 'subtype': 'COLOR', 23 | 'min': 0, 24 | 'max': 1, 25 | } 26 | 27 | drivers.append(d0) 28 | 29 | # Color 1 - Green Channel 30 | d1 = { 31 | 'object': object, 32 | 'property': 'Color1', 33 | 'value': [0.016370, 0.068727, 0.016674, 1.000000], 34 | 'driven_value': 'nodes["ColorRamp"].color_ramp.elements[0].color', 35 | 'driven_object' : object.material_slots[0].material.node_tree, 36 | 'index' : 1, 37 | 'variable_name' : 'var', 38 | 'data_path' : '["Color1"][1]', 39 | 'id_type' : 'OBJECT', 40 | 'subtype': 'COLOR', 41 | 'min': 0, 42 | 'max': 1, 43 | } 44 | 45 | drivers.append(d1) 46 | 47 | # Color 1 - Blue Channel 48 | d2 = { 49 | 'object': object, 50 | 'property': 'Color1', 51 | 'value': [0.016370, 0.068727, 0.016674, 1.000000], 52 | 'driven_value': 'nodes["ColorRamp"].color_ramp.elements[0].color', 53 | 'driven_object' : object.material_slots[0].material.node_tree, 54 | 'index' : 2, 55 | 'variable_name' : 'var', 56 | 'data_path' : '["Color1"][2]', 57 | 'id_type' : 'OBJECT', 58 | 'subtype': 'COLOR', 59 | 'min': 0, 60 | 'max': 1, 61 | } 62 | 63 | drivers.append(d2) 64 | 65 | # Color 2 - Red Channel 66 | d3 = { 67 | 'object': object, 68 | 'property': 'Color2', 69 | 'value': [0.076728, 0.076728, 0.076728, 1.000000], 70 | 'driven_value': 'nodes["ColorRamp"].color_ramp.elements[1].color', 71 | 'driven_object' : object.material_slots[0].material.node_tree, 72 | 'index' : 0, 73 | 'variable_name' : 'var', 74 | 'data_path' : '["Color2"][0]', 75 | 'id_type' : 'OBJECT', 76 | 'subtype': 'COLOR', 77 | 'min': 0, 78 | 'max': 1, 79 | } 80 | 81 | drivers.append(d3) 82 | 83 | # Color 2 - Green Channel 84 | d4 = { 85 | 'object': object, 86 | 'property': 'Color2', 87 | 'value': [0.076728, 0.076728, 0.076728, 1.000000], 88 | 'driven_value': 'nodes["ColorRamp"].color_ramp.elements[1].color', 89 | 'driven_object' : object.material_slots[0].material.node_tree, 90 | 'index' : 1, 91 | 'variable_name' : 'var', 92 | 'data_path' : '["Color2"][1]', 93 | 'id_type' : 'OBJECT', 94 | 'subtype': 'COLOR', 95 | 'min': 0, 96 | 'max': 1, 97 | } 98 | 99 | drivers.append(d4) 100 | 101 | # Color 2 - Blue Channel 102 | d5 = { 103 | 'object': object, 104 | 'property': 'Color2', 105 | 'value': [0.076728, 0.076728, 0.076728, 1.000000], 106 | 'driven_value': 'nodes["ColorRamp"].color_ramp.elements[1].color', 107 | 'driven_object' : object.material_slots[0].material.node_tree, 108 | 'index' : 2, 109 | 'variable_name' : 'var', 110 | 'data_path' : '["Color2"][2]', 111 | 'id_type' : 'OBJECT', 112 | 'subtype': 'COLOR', 113 | 'min': 0, 114 | 'max': 1, 115 | } 116 | 117 | drivers.append(d5) 118 | 119 | # Color 3 - Red Channel 120 | d6 = { 121 | 'object': object, 122 | 'property': 'Color3', 123 | 'value': [0.571661, 0.571661, 0.571661, 1.000000], 124 | 'driven_value': 'nodes["ColorRamp"].color_ramp.elements[2].color', 125 | 'driven_object' : object.material_slots[0].material.node_tree, 126 | 'index' : 0, 127 | 'variable_name' : 'var', 128 | 'data_path' : '["Color3"][0]', 129 | 'id_type' : 'OBJECT', 130 | 'subtype': 'COLOR', 131 | 'min': 0, 132 | 'max': 1, 133 | } 134 | 135 | drivers.append(d6) 136 | 137 | # Color 3 - Green Channel 138 | d7 = { 139 | 'object': object, 140 | 'property': 'Color3', 141 | 'value': [0.571661, 0.571661, 0.571661, 1.000000], 142 | 'driven_value': 'nodes["ColorRamp"].color_ramp.elements[2].color', 143 | 'driven_object' : object.material_slots[0].material.node_tree, 144 | 'index' : 1, 145 | 'variable_name' : 'var', 146 | 'data_path' : '["Color3"][1]', 147 | 'id_type' : 'OBJECT', 148 | 'subtype': 'COLOR', 149 | 'min': 0, 150 | 'max': 1, 151 | } 152 | 153 | drivers.append(d7) 154 | 155 | # Color 3 - Blue Channel 156 | d8 = { 157 | 'object': object, 158 | 'property': 'Color3', 159 | 'value': [0.571661, 0.571661, 0.571661, 1.000000], 160 | 'driven_value': 'nodes["ColorRamp"].color_ramp.elements[2].color', 161 | 'driven_object' : object.material_slots[0].material.node_tree, 162 | 'index' : 2, 163 | 'variable_name' : 'var', 164 | 'data_path' : '["Color3"][2]', 165 | 'id_type' : 'OBJECT', 166 | 'subtype': 'COLOR', 167 | 'min': 0, 168 | 'max': 1, 169 | } 170 | 171 | drivers.append(d8) 172 | 173 | # Extend X 174 | d18 = { 175 | 'object': object, 176 | 'property': 'ExtendX', 177 | 'value': 1, 178 | 'driven_value': 'count', 179 | 'driven_object' : object.modifiers['Array'], 180 | 'index' : -1, 181 | 'variable_name' : 'var', 182 | 'data_path' : '["ExtendX"]', 183 | 'id_type' : 'OBJECT', 184 | 'subtype': '', 185 | 'min': 0, 186 | 'max': 100, 187 | } 188 | 189 | drivers.append(d18) 190 | 191 | # Extend Y 192 | d19 = { 193 | 'object': object, 194 | 'property': 'ExtendY', 195 | 'value': 1, 196 | 'driven_value': 'count', 197 | 'driven_object' : object.modifiers['Array.001'], 198 | 'index' : -1, 199 | 'variable_name' : 'var', 200 | 'data_path' : '["ExtendY"]', 201 | 'id_type' : 'OBJECT', 202 | 'subtype': '', 203 | 'min': 0, 204 | 'max': 100, 205 | } 206 | 207 | drivers.append(d19) 208 | 209 | # Stone Randomness 210 | d20 = { 211 | 'object': object, 212 | 'property': 'StoneRandom', 213 | 'value': 1.0, 214 | 'driven_value': 'nodes["Voronoi Texture"].inputs[5].default_value', 215 | 'driven_object' : object.material_slots[0].material.node_tree, 216 | 'index' : -1, 217 | 'variable_name' : 'var', 218 | 'data_path' : '["StoneRandom"]', 219 | 'id_type' : 'OBJECT', 220 | 'subtype': '', 221 | 'min': 0, 222 | 'max': 100, 223 | } 224 | 225 | drivers.append(d20) 226 | 227 | # Lines Mix 228 | d21 = { 229 | 'object': object, 230 | 'property': 'LinesMix', 231 | 'value': 1.0, 232 | 'driven_value': 'nodes["Mix"].inputs[0].default_value', 233 | 'driven_object' : object.material_slots[0].material.node_tree, 234 | 'index' : -1, 235 | 'variable_name' : 'var', 236 | 'data_path' : '["LinesMix"]', 237 | 'id_type' : 'OBJECT', 238 | 'subtype': '', 239 | 'min': 0, 240 | 'max': 1, 241 | } 242 | 243 | drivers.append(d21) 244 | 245 | # Noise Scale 246 | d22 = { 247 | 'object': object, 248 | 'property': 'NoiseScale', 249 | 'value': 10.0, 250 | 'driven_value': 'nodes["Noise Texture"].inputs[2].default_value', 251 | 'driven_object' : object.material_slots[0].material.node_tree, 252 | 'index' : -1, 253 | 'variable_name' : 'var', 254 | 'data_path' : '["NoiseScale"]', 255 | 'id_type' : 'OBJECT', 256 | 'subtype': '', 257 | 'min': -100, 258 | 'max': 100, 259 | } 260 | 261 | drivers.append(d22) 262 | 263 | # Stone Scale 264 | d23 = { 265 | 'object': object, 266 | 'property': 'StoneScale', 267 | 'value': 3.0, 268 | 'driven_value': 'nodes["Voronoi Texture"].inputs[2].default_value', 269 | 'driven_object' : object.material_slots[0].material.node_tree, 270 | 'index' : -1, 271 | 'variable_name' : 'var', 272 | 'data_path' : '["StoneScale"]', 273 | 'id_type' : 'OBJECT', 274 | 'subtype': '', 275 | 'min': 0, 276 | 'max': 1000, 277 | } 278 | 279 | drivers.append(d23) 280 | 281 | # Distortion Scale 282 | d24 = { 283 | 'object': object, 284 | 'property': 'DistortionScale', 285 | 'value': 1.0, 286 | 'driven_value': 'nodes["Noise Texture.001"].inputs[2].default_value', 287 | 'driven_object' : object.material_slots[0].material.node_tree, 288 | 'index' : -1, 289 | 'variable_name' : 'var', 290 | 'data_path' : '["DistortionScale"]', 291 | 'id_type' : 'OBJECT', 292 | 'subtype': '', 293 | 'min': 0, 294 | 'max': 10, 295 | } 296 | 297 | drivers.append(d24) 298 | 299 | for d in drivers: 300 | d['object'][d['property']] = d['value'] 301 | 302 | edit_property = d['object'].id_properties_ui(d['property']) 303 | edit_property.update(min=d['min'], max=d['max']) 304 | 305 | if d['subtype']: 306 | edit_property.update(subtype=d['subtype']) 307 | 308 | driver = d['driven_object'].driver_add(d['driven_value'], d['index']) 309 | 310 | variable = driver.driver.variables.new() 311 | variable.name = d['variable_name'] 312 | variable.targets[0].id_type = d['id_type'] 313 | variable.targets[0].id = d['object'] 314 | variable.targets[0].data_path = d['data_path'] 315 | 316 | driver.driver.expression = variable.name 317 | 318 | # Update Driver Dependencies 319 | d['object'].hide_render = d['object'].hide_render 320 | -------------------------------------------------------------------------------- /GroundPlanes/GrassPlane.py: -------------------------------------------------------------------------------- 1 | # Grass Generator 2 | import bpy 3 | 4 | from .Drivers.GrassPlaneDrivers import * 5 | 6 | def generateGrassPlane(): 7 | 8 | bpy.ops.mesh.primitive_plane_add(size=2, enter_editmode=False, align='WORLD', location=(0, 0, 0), scale=(1, 1, 1)) 9 | grassplane = bpy.context.object 10 | grassplane.name = 'Grass' 11 | bpy.ops.object.shade_smooth() 12 | 13 | bpy.ops.object.modifier_add(type='ARRAY') 14 | array_x = grassplane.modifiers['Array'] 15 | array_x.count = 1 16 | 17 | bpy.ops.object.modifier_add(type='ARRAY') 18 | array_y = grassplane.modifiers['Array.001'] 19 | array_y.count = 1 20 | array_y.relative_offset_displace[0] = 0 21 | array_y.relative_offset_displace[1] = 1 22 | 23 | bpy.ops.object.modifier_add(type='SUBSURF') 24 | subsurf = grassplane.modifiers["Subdivision"] 25 | subsurf.levels = 3 26 | subsurf.render_levels = 3 27 | subsurf.subdivision_type = 'SIMPLE' 28 | 29 | grasstex = bpy.data.textures.new(name='GrassTexture', type = 'CLOUDS') 30 | grasstex.noise_scale = 1 31 | 32 | bpy.ops.object.modifier_add(type='DISPLACE') 33 | displace = grassplane.modifiers["Displace"] 34 | displace.texture_coords = 'GLOBAL' 35 | displace.strength = 0.5 36 | displace.texture = grasstex 37 | 38 | bpy.ops.object.particle_system_add() 39 | bpy.context.object.particle_systems[0].name = 'GrassParticles' 40 | particle = bpy.context.object.particle_systems[0].settings 41 | particle.name = 'GrassParticleSettings' 42 | particle.type = 'HAIR' 43 | particle.count = 5000 44 | particle.hair_length = 0.2 45 | particle.hair_step = 2 46 | particle.render_step = 2 47 | particle.child_type = 'SIMPLE' 48 | particle.clump_factor = -1 49 | particle.use_modifier_stack = True 50 | bpy.context.scene.render.hair_type = 'STRIP' 51 | 52 | grassmat = bpy.data.materials.new(name='GrassMaterial') 53 | grassmat.use_nodes = True 54 | grassmat.shadow_method = 'NONE' 55 | grassmat.node_tree.nodes.clear() 56 | 57 | nodes = grassmat.node_tree.nodes 58 | 59 | output = nodes.new(type='ShaderNodeOutputMaterial') 60 | 61 | # Translucent & Normal Node 62 | translucent = nodes.new(type='ShaderNodeBsdfTranslucent') 63 | normal = nodes.new(type='ShaderNodeNormal') 64 | normal.outputs[0].default_value = (0, 0, -1) 65 | # Ends 66 | 67 | colorramp = nodes.new(type='ShaderNodeValToRGB') 68 | colorramp.color_ramp.elements[0].color = (0, 0.1, 0.04, 1) 69 | colorramp.color_ramp.elements[1].color = (0, 0.5, 0.15, 1) 70 | noise = nodes.new(type='ShaderNodeTexNoise') 71 | 72 | links = grassmat.node_tree.links 73 | 74 | links.new(translucent.outputs[0], output.inputs[0]) 75 | links.new(colorramp.outputs[0], translucent.inputs[0]) 76 | links.new(normal.outputs[0], translucent.inputs[1]) 77 | links.new(noise.outputs[0], colorramp.inputs[0]) 78 | 79 | bpy.context.object.data.materials.append(grassmat) 80 | 81 | # Add a third color to the Grass ColorRamp 82 | 83 | class OBJECT_OT_generateGrassPlane(bpy.types.Operator): 84 | """Create a stylized grass plane""" 85 | bl_idname = "mesh.generate_grass_plane" 86 | bl_label = "Add Stylized Grass" 87 | bl_options = {'REGISTER', 'UNDO'} 88 | 89 | def execute(self, context): 90 | 91 | generateGrassPlane() 92 | assignDrivers() 93 | 94 | return {'FINISHED'} 95 | -------------------------------------------------------------------------------- /GroundPlanes/IcePlane.py: -------------------------------------------------------------------------------- 1 | # Ice Plane Generator 2 | import bpy 3 | 4 | from .Drivers.IcePlaneDrivers import * 5 | 6 | def generateIcePlane(): 7 | 8 | bpy.ops.mesh.primitive_plane_add(size=2, enter_editmode=False, align='WORLD', location=(0, 0, 0), scale=(1, 1, 1)) 9 | iceplane = bpy.context.object 10 | iceplane.name = 'Ice' 11 | bpy.ops.object.shade_smooth() 12 | 13 | bpy.ops.object.modifier_add(type='ARRAY') 14 | array_x = iceplane.modifiers['Array'] 15 | array_x.count = 1 16 | 17 | bpy.ops.object.modifier_add(type='ARRAY') 18 | array_y = iceplane.modifiers['Array.001'] 19 | array_y.count = 1 20 | array_y.relative_offset_displace[0] = 0 21 | array_y.relative_offset_displace[1] = 1 22 | 23 | bpy.ops.object.modifier_add(type='SUBSURF') 24 | subsurf = iceplane.modifiers["Subdivision"] 25 | subsurf.levels = 4 26 | subsurf.render_levels = 4 27 | subsurf.subdivision_type = 'SIMPLE' 28 | 29 | icetex = bpy.data.textures.new(name='IceTexture', type = 'CLOUDS') 30 | icetex.noise_scale = 1 31 | 32 | bpy.ops.object.modifier_add(type='DISPLACE') 33 | displace = iceplane.modifiers["Displace"] 34 | displace.texture_coords = 'GLOBAL' 35 | displace.strength = 0.005 36 | displace.texture = icetex 37 | 38 | icemat = bpy.data.materials.new(name='icematerial') 39 | icemat.use_nodes = True 40 | icemat.blend_method = 'BLEND' 41 | icemat.node_tree.nodes.clear() 42 | 43 | nodes = icemat.node_tree.nodes 44 | 45 | output = nodes.new(type='ShaderNodeOutputMaterial') 46 | 47 | mixshader0 = nodes.new(type='ShaderNodeMixShader') 48 | mixshader1 = nodes.new(type='ShaderNodeMixShader') 49 | 50 | # Translucent & Normal Node 51 | translucent = nodes.new(type='ShaderNodeBsdfTranslucent') 52 | translucent.inputs[0].default_value = [0.183718, 0.330284, 0.800000, 1.000000] 53 | normal = nodes.new(type='ShaderNodeNormal') 54 | normal.outputs[0].default_value = (0, 0, -1) 55 | # Ends 56 | 57 | transparent = nodes.new(type='ShaderNodeBsdfTransparent') 58 | 59 | voronoi0 = nodes.new(type='ShaderNodeTexVoronoi') 60 | voronoi0.inputs[2].default_value = 2 61 | 62 | noise0 = nodes.new(type='ShaderNodeTexNoise') 63 | noise0.inputs[2].default_value = 2 64 | 65 | colorramp0 = nodes.new(type='ShaderNodeValToRGB') 66 | colorramp0.color_ramp.interpolation = 'CONSTANT' 67 | colorramp0.color_ramp.elements.new(0.5) 68 | colorramp0.color_ramp.elements[0].color = [0.094031, 0.292350, 0.604645, 1.000000] 69 | colorramp0.color_ramp.elements[1].color = [0.211978, 0.482632, 0.818554, 1.000000] 70 | colorramp0.color_ramp.elements[2].color = [1.0, 1.0, 1.0, 1.000000] 71 | colorramp0.color_ramp.elements[0].position = 0.0 72 | colorramp0.color_ramp.elements[1].position = 0.859 73 | colorramp0.color_ramp.elements[2].position = 1.0 74 | 75 | shadertorgb = nodes.new(type='ShaderNodeShaderToRGB') 76 | 77 | glossy = nodes.new(type='ShaderNodeBsdfGlossy') 78 | 79 | colorramp1 = nodes.new(type='ShaderNodeValToRGB') 80 | colorramp1.color_ramp.elements[0].position = 0.141 81 | colorramp1.color_ramp.elements[1].position = 0.4 82 | 83 | screen = nodes.new(type='ShaderNodeMixRGB') 84 | screen.blend_type = 'SCREEN' 85 | screen.inputs[0].default_value = 1 86 | 87 | voronoi1 = nodes.new(type='ShaderNodeTexVoronoi') 88 | voronoi1.voronoi_dimensions = '2D' 89 | voronoi1.feature = 'DISTANCE_TO_EDGE' 90 | voronoi1.inputs[2].default_value = 50 91 | 92 | noise1 = nodes.new(type='ShaderNodeTexNoise') 93 | noise1.inputs[2].default_value = 35 94 | noise1.inputs[4].default_value = 0 95 | 96 | links = icemat.node_tree.links 97 | 98 | links.new(mixshader0.outputs[0], output.inputs[0]) 99 | 100 | links.new(translucent.outputs[0], mixshader0.inputs[2]) 101 | links.new(normal.outputs[0], translucent.inputs[1]) 102 | 103 | links.new(mixshader1.outputs[0], mixshader0.inputs[1]) 104 | 105 | links.new(colorramp0.outputs[0], mixshader1.inputs[1]) 106 | links.new(shadertorgb.outputs[0], colorramp0.inputs[0]) 107 | links.new(glossy.outputs[0], shadertorgb.inputs[0]) 108 | links.new(colorramp1.outputs[0], glossy.inputs[0]) 109 | links.new(screen.outputs[0], colorramp1.inputs[0]) 110 | links.new(voronoi1.outputs[0], screen.inputs[1]) 111 | links.new(noise1.outputs[0], screen.inputs[2]) 112 | 113 | links.new(transparent.outputs[0], mixshader1.inputs[2]) 114 | links.new(voronoi0.outputs[0], mixshader1.inputs[0]) 115 | links.new(voronoi0.outputs[0], transparent.inputs[0]) 116 | links.new(noise0.outputs[0], voronoi0.inputs[0]) 117 | 118 | bpy.context.object.data.materials.append(icemat) 119 | 120 | 121 | class OBJECT_OT_generateIcePlane(bpy.types.Operator): 122 | """Create a stylized ice plane""" 123 | bl_idname = "mesh.generate_ice_plane" 124 | bl_label = "Add Stylized Ice" 125 | bl_options = {'REGISTER', 'UNDO'} 126 | 127 | def execute(self, context): 128 | 129 | generateIcePlane() 130 | assignDrivers() 131 | 132 | return {'FINISHED'} 133 | -------------------------------------------------------------------------------- /GroundPlanes/RoadPlane.py: -------------------------------------------------------------------------------- 1 | # Road Plane Generator 2 | import bpy 3 | 4 | from .Drivers.RoadPlaneDrivers import * 5 | 6 | def generateRoadPlane(): 7 | 8 | bpy.ops.mesh.primitive_plane_add(size=2, enter_editmode=False, align='WORLD', location=(0, 0, 0), scale=(1, 1, 1)) 9 | roadplane = bpy.context.object 10 | roadplane.name = 'Road' 11 | bpy.ops.object.shade_smooth() 12 | 13 | bpy.ops.object.modifier_add(type='ARRAY') 14 | array_y = roadplane.modifiers['Array'] 15 | array_y.count = 1 16 | array_y.relative_offset_displace[0] = 0 17 | array_y.relative_offset_displace[1] = 1 18 | 19 | bpy.ops.object.modifier_add(type='SUBSURF') 20 | subsurf = roadplane.modifiers["Subdivision"] 21 | subsurf.levels = 4 22 | subsurf.render_levels = 4 23 | subsurf.subdivision_type = 'SIMPLE' 24 | 25 | roadtex = bpy.data.textures.new(name='roadtexture', type = 'CLOUDS') 26 | roadtex.noise_scale = 1 27 | 28 | bpy.ops.object.modifier_add(type='DISPLACE') 29 | displace = roadplane.modifiers["Displace"] 30 | displace.texture_coords = 'GLOBAL' 31 | displace.strength = 0.01 32 | displace.texture = roadtex 33 | 34 | roadmat = bpy.data.materials.new(name='roadmaterial') 35 | roadmat.use_nodes = True 36 | roadmat.node_tree.nodes.clear() 37 | 38 | nodes = roadmat.node_tree.nodes 39 | 40 | output = nodes.new(type='ShaderNodeOutputMaterial') 41 | 42 | # Translucent & Normal Node 43 | translucent = nodes.new(type='ShaderNodeBsdfTranslucent') 44 | normal = nodes.new(type='ShaderNodeNormal') 45 | normal.outputs[0].default_value = (0, 0, -1) 46 | # Ends 47 | 48 | multiply0 = nodes.new(type='ShaderNodeMixRGB') 49 | multiply0.blend_type = 'MULTIPLY' 50 | multiply0.inputs[0].default_value = 1 51 | 52 | multiply1 = nodes.new(type='ShaderNodeMixRGB') 53 | multiply1.blend_type = 'MULTIPLY' 54 | 55 | mix0 = nodes.new(type='ShaderNodeMixRGB') 56 | 57 | colorramp0 = nodes.new(type='ShaderNodeValToRGB') 58 | colorramp0.color_ramp.interpolation = 'CONSTANT' 59 | colorramp0.color_ramp.elements.new(0.5) 60 | colorramp0.color_ramp.elements.new(0.25) 61 | colorramp0.color_ramp.elements.new(0.125) 62 | colorramp0.color_ramp.elements[0].position = 0.0 63 | colorramp0.color_ramp.elements[1].position = 0.05 64 | colorramp0.color_ramp.elements[2].position = 0.08 65 | colorramp0.color_ramp.elements[3].position = 0.92 66 | colorramp0.color_ramp.elements[4].position = 0.95 67 | colorramp0.color_ramp.elements[0].color = [0.063267, 0.063267, 0.063267, 1.000000] 68 | colorramp0.color_ramp.elements[1].color = [0.922121, 1.000000, 0.000000, 1.000000] 69 | colorramp0.color_ramp.elements[2].color = [0.063267, 0.063267, 0.063267, 1.000000] 70 | colorramp0.color_ramp.elements[3].color = [0.922121, 1.000000, 0.000000, 1.000000] 71 | colorramp0.color_ramp.elements[4].color = [0.063267, 0.063267, 0.063267, 1.000000] 72 | 73 | gradient = nodes.new(type='ShaderNodeTexGradient') 74 | 75 | mapping = nodes.new(type='ShaderNodeMapping') 76 | 77 | texcoord = nodes.new(type='ShaderNodeTexCoord') 78 | 79 | multiply2 = nodes.new(type='ShaderNodeMixRGB') 80 | multiply2.blend_type = 'MULTIPLY' 81 | multiply2.inputs[0].default_value = 1 82 | 83 | colorramp1 = nodes.new(type='ShaderNodeValToRGB') 84 | colorramp1.color_ramp.interpolation = 'CONSTANT' 85 | colorramp1.color_ramp.elements.new(0.5) 86 | colorramp1.color_ramp.elements[0].position = 0.48 87 | colorramp1.color_ramp.elements[1].position = 0.5 88 | colorramp1.color_ramp.elements[2].position = 0.52 89 | colorramp1.color_ramp.elements[0].color = (0.0, 0.0, 0.0, 0.000000) 90 | colorramp1.color_ramp.elements[1].color = (1.0, 1.0, 1.0, 1.000000) 91 | colorramp1.color_ramp.elements[2].color = (0.0, 0.0, 0.0, 0.0) 92 | 93 | colorramp2 = nodes.new(type='ShaderNodeValToRGB') 94 | colorramp2.color_ramp.interpolation = 'CONSTANT' 95 | colorramp2.color_ramp.elements[1].position = 0.464 96 | 97 | wave = nodes.new(type='ShaderNodeTexWave') 98 | wave.bands_direction = 'Y' 99 | wave.inputs[1].default_value = 0.6 100 | wave.inputs[5].default_value = 1 101 | 102 | colordodge = nodes.new(type='ShaderNodeMixRGB') 103 | colordodge.blend_type = 'DODGE' 104 | colordodge.inputs[0].default_value = 1 105 | 106 | noise0 = nodes.new(type='ShaderNodeTexNoise') 107 | noise0.inputs[2].default_value = 11.1 108 | noise0.inputs[3].default_value = 15 109 | noise0.inputs[4].default_value = 0.292 110 | 111 | colorramp3 = nodes.new(type='ShaderNodeValToRGB') 112 | colorramp3.color_ramp.elements[1].position = 0.005 113 | 114 | voronoi = nodes.new(type='ShaderNodeTexVoronoi') 115 | voronoi.feature = 'DISTANCE_TO_EDGE' 116 | voronoi.inputs[2].default_value = 6.7 117 | 118 | mix1 = nodes.new(type='ShaderNodeMixRGB') 119 | mix1.inputs[0].default_value = 0.1 120 | 121 | noise1 = nodes.new(type='ShaderNodeTexNoise') 122 | noise1.inputs[2].default_value = 200 123 | noise1.inputs[3].default_value = 3 124 | noise1.inputs[4].default_value = 1 125 | 126 | noise2 = nodes.new(type='ShaderNodeTexNoise') 127 | 128 | links = roadmat.node_tree.links 129 | 130 | links.new(translucent.outputs[0], output.inputs[0]) 131 | links.new(normal.outputs[0], translucent.inputs[1]) 132 | 133 | links.new(multiply0.outputs[0], translucent.inputs[0]) 134 | links.new(multiply1.outputs[0], multiply0.inputs[1]) 135 | 136 | links.new(mix0.outputs[0], multiply1.inputs[1]) 137 | links.new(colorramp0.outputs[0], mix0.inputs[1]) 138 | links.new(gradient.outputs[0], colorramp0.inputs[0]) 139 | links.new(mapping.outputs[0], gradient.inputs[0]) 140 | links.new(texcoord.outputs[0], mapping.inputs[0]) 141 | 142 | links.new(multiply2.outputs[0], mix0.inputs[2]) 143 | links.new(colorramp1.outputs[0], multiply2.inputs[1]) 144 | links.new(gradient.outputs[0], colorramp1.inputs[0]) 145 | links.new(mapping.outputs[0], wave.inputs[0]) 146 | 147 | links.new(colorramp2.outputs[0], multiply2.inputs[2]) 148 | links.new(wave.outputs[0], colorramp2.inputs[0]) 149 | 150 | links.new(noise1.outputs[0], multiply1.inputs[2]) 151 | links.new(mapping.outputs[0], noise1.inputs[0]) 152 | 153 | links.new(colordodge.outputs[0], multiply0.inputs[2]) 154 | links.new(noise0.outputs[0], colordodge.inputs[1]) 155 | links.new(colorramp3.outputs[0], colordodge.inputs[2]) 156 | links.new(voronoi.outputs[0], colorramp3.inputs[0]) 157 | links.new(mix1.outputs[0], voronoi.inputs[0]) 158 | links.new(noise2.outputs[0], mix1.inputs[2]) 159 | links.new(mapping.outputs[0], gradient.inputs[0]) 160 | links.new(mapping.outputs[0], mix1.inputs[1]) 161 | links.new(mapping.outputs[0], noise2.inputs[0]) 162 | 163 | bpy.context.object.data.materials.append(roadmat) 164 | 165 | 166 | class OBJECT_OT_generateRoadRlane(bpy.types.Operator): 167 | """Create a stylized road plane""" 168 | bl_idname = "mesh.generate_road_plane" 169 | bl_label = "Add Stylized Road" 170 | bl_options = {'REGISTER', 'UNDO'} 171 | 172 | def execute(self, context): 173 | 174 | generateRoadPlane() 175 | assignDrivers() 176 | 177 | return {'FINISHED'} 178 | -------------------------------------------------------------------------------- /GroundPlanes/RockWallPlane.py: -------------------------------------------------------------------------------- 1 | # Rock Wall Plane Generator 2 | import bpy 3 | 4 | from .Drivers.RockWallPlaneDrivers import * 5 | 6 | def generateRockWallPlane(): 7 | 8 | bpy.ops.mesh.primitive_plane_add(size=2, enter_editmode=False, align='WORLD', location=(0, 0, 0), scale=(1, 1, 1)) 9 | rockwall = bpy.context.object 10 | rockwall.name = 'RockWall' 11 | rockwall.rotation_euler[1] = 1.5708 12 | bpy.ops.object.shade_smooth() 13 | 14 | bpy.ops.object.modifier_add(type='ARRAY') 15 | array_x = rockwall.modifiers['Array'] 16 | array_x.count = 1 17 | 18 | bpy.ops.object.modifier_add(type='ARRAY') 19 | array_y = rockwall.modifiers['Array.001'] 20 | array_y.count = 1 21 | array_y.relative_offset_displace[0] = 0 22 | array_y.relative_offset_displace[1] = 1 23 | 24 | bpy.ops.object.modifier_add(type='SUBSURF') 25 | subsurf = rockwall.modifiers["Subdivision"] 26 | subsurf.levels = 2 27 | subsurf.render_levels = 2 28 | subsurf.subdivision_type = 'SIMPLE' 29 | 30 | 31 | rockwallmat = bpy.data.materials.new(name='rockwallmaterial') 32 | rockwallmat.use_nodes = True 33 | rockwallmat.node_tree.nodes.clear() 34 | 35 | nodes = rockwallmat.node_tree.nodes 36 | 37 | output = nodes.new(type='ShaderNodeOutputMaterial') 38 | 39 | # Translucent & Normal Node 40 | translucent = nodes.new(type='ShaderNodeBsdfTranslucent') 41 | normal = nodes.new(type='ShaderNodeNormal') 42 | normal.outputs[0].default_value = (0, 0, -1) 43 | # Ends 44 | 45 | colorramp0 = nodes.new(type='ShaderNodeValToRGB') 46 | colorramp0.color_ramp.interpolation = 'B_SPLINE' 47 | colorramp0.color_ramp.elements.new(0.5) 48 | colorramp0.color_ramp.elements[0].color = [0.010113, 0.006843, 0.002995, 1.000000] 49 | colorramp0.color_ramp.elements[1].color = [0.076728, 0.045395, 0.013369, 1.000000] 50 | colorramp0.color_ramp.elements[2].color = [0.571661, 0.423131, 0.123842, 1.000000] 51 | colorramp0.color_ramp.elements[0].position = 0.001 52 | colorramp0.color_ramp.elements[1].position = 0.332 53 | colorramp0.color_ramp.elements[2].position = 1.0 54 | 55 | shadertorgb = nodes.new(type='ShaderNodeShaderToRGB') 56 | 57 | diffuse = nodes.new(type='ShaderNodeBsdfDiffuse') 58 | 59 | multiply0 = nodes.new(type='ShaderNodeMixRGB') 60 | multiply0.blend_type = 'MULTIPLY' 61 | multiply0.inputs[0].default_value = 1 62 | 63 | multiply1 = nodes.new(type='ShaderNodeMixRGB') 64 | multiply1.blend_type = 'MULTIPLY' 65 | multiply1.inputs[0].default_value = 1 66 | multiply1.inputs[2].default_value = [0.154261, 0.154261, 0.154261, 1.000000] 67 | 68 | voronoi0 = nodes.new(type='ShaderNodeTexVoronoi') 69 | voronoi0.feature = 'DISTANCE_TO_EDGE' 70 | voronoi0.inputs[2].default_value = 3 71 | 72 | noise0 = nodes.new(type='ShaderNodeTexNoise') 73 | noise0.inputs[2].default_value = 10 74 | 75 | noise1 = nodes.new(type='ShaderNodeTexNoise') 76 | noise1.inputs[2].default_value = 1 77 | noise1.inputs[3].default_value = 15 78 | 79 | mapping0 = nodes.new(type='ShaderNodeMapping') 80 | 81 | mapping1 = nodes.new(type='ShaderNodeMapping') 82 | 83 | texcoord = nodes.new(type='ShaderNodeTexCoord') 84 | 85 | bump = nodes.new(type='ShaderNodeBump') 86 | bump.inputs[0].default_value = 0 87 | 88 | links = rockwallmat.node_tree.links 89 | 90 | links.new(translucent.outputs[0], output.inputs[0]) 91 | links.new(normal.outputs[0], translucent.inputs[1]) 92 | links.new(colorramp0.outputs[0], translucent.inputs[0]) 93 | links.new(shadertorgb.outputs[0], colorramp0.inputs[0]) 94 | links.new(diffuse.outputs[0], shadertorgb.inputs[0]) 95 | 96 | links.new(multiply0.outputs[0], diffuse.inputs[0]) 97 | links.new(noise0.outputs[0], multiply0.inputs[1]) 98 | links.new(mapping1.outputs[0], noise0.inputs[0]) 99 | links.new(texcoord.outputs[0], mapping1.inputs[0]) 100 | 101 | links.new(multiply0.outputs[0], bump.inputs[2]) 102 | links.new(bump.outputs[0], diffuse.inputs[2]) 103 | 104 | links.new(voronoi0.outputs[0], output.inputs[2]) 105 | 106 | links.new(voronoi0.outputs[0], multiply0.inputs[2]) 107 | links.new(mapping0.outputs[0], voronoi0.inputs[0]) 108 | links.new(mapping1.outputs[0], mapping0.inputs[0]) 109 | links.new(multiply1.outputs[0], mapping0.inputs[1]) 110 | links.new(noise1.outputs[0], multiply1.inputs[1]) 111 | links.new(texcoord.outputs[0], noise1.inputs[0]) 112 | 113 | bpy.context.object.data.materials.append(rockwallmat) 114 | 115 | 116 | class OBJECT_OT_generateRockWallPlane(bpy.types.Operator): 117 | """Create a stylized rock wall plane""" 118 | bl_idname = "mesh.generate_rock_wall_plane" 119 | bl_label = "Add Stylized Rock Wall" 120 | bl_options = {'REGISTER', 'UNDO'} 121 | 122 | def execute(self, context): 123 | 124 | generateRockWallPlane() 125 | assignDrivers() 126 | 127 | return {'FINISHED'} 128 | -------------------------------------------------------------------------------- /GroundPlanes/SandPlane.py: -------------------------------------------------------------------------------- 1 | # Sand Plane Generator 2 | import bpy 3 | 4 | from .Drivers.SandPlaneDrivers import * 5 | 6 | def generateSandPlane(): 7 | 8 | bpy.ops.mesh.primitive_plane_add(size=2, enter_editmode=False, align='WORLD', location=(0, 0, 0), scale=(1, 1, 1)) 9 | sandplane = bpy.context.object 10 | sandplane.name = 'Sand' 11 | bpy.ops.object.shade_smooth() 12 | 13 | bpy.ops.object.modifier_add(type='ARRAY') 14 | array_x = sandplane.modifiers['Array'] 15 | array_x.count = 1 16 | 17 | bpy.ops.object.modifier_add(type='ARRAY') 18 | array_y = sandplane.modifiers['Array.001'] 19 | array_y.count = 1 20 | array_y.relative_offset_displace[0] = 0 21 | array_y.relative_offset_displace[1] = 1 22 | 23 | bpy.ops.object.modifier_add(type='SUBSURF') 24 | subsurf = sandplane.modifiers["Subdivision"] 25 | subsurf.levels = 4 26 | subsurf.render_levels = 4 27 | subsurf.subdivision_type = 'SIMPLE' 28 | 29 | sandtex = bpy.data.textures.new(name='SandTexture', type = 'CLOUDS') 30 | sandtex.noise_scale = 1 31 | 32 | bpy.ops.object.modifier_add(type='DISPLACE') 33 | displace = sandplane.modifiers["Displace"] 34 | displace.texture_coords = 'GLOBAL' 35 | displace.strength = 0.5 36 | displace.texture = sandtex 37 | 38 | bpy.ops.object.modifier_add(type='SUBSURF') 39 | subsurf1 = sandplane.modifiers["Subdivision.001"] 40 | subsurf1.levels = 3 41 | subsurf1.render_levels = 3 42 | 43 | sandmat = bpy.data.materials.new(name='sandmaterial') 44 | sandmat.use_nodes = True 45 | sandmat.node_tree.nodes.clear() 46 | 47 | nodes = sandmat.node_tree.nodes 48 | 49 | output = nodes.new(type='ShaderNodeOutputMaterial') 50 | 51 | # Translucent & Normal Node 52 | translucent = nodes.new(type='ShaderNodeBsdfTranslucent') 53 | normal = nodes.new(type='ShaderNodeNormal') 54 | normal.outputs[0].default_value = (0, 0, -1) 55 | # Ends 56 | 57 | multiply = nodes.new(type='ShaderNodeMixRGB') 58 | multiply.blend_type = 'MULTIPLY' 59 | 60 | colorramp0 = nodes.new(type='ShaderNodeValToRGB') 61 | colorramp0.color_ramp.interpolation = 'CONSTANT' 62 | colorramp0.color_ramp.elements[0].color = [0.273416, 0.222385, 0.073390, 1.000000] 63 | colorramp0.color_ramp.elements[1].color = [0.641803, 0.656629, 0.100958, 1.000000] 64 | colorramp0.color_ramp.elements[1].position = 0.6 65 | 66 | shadertorgb = nodes.new(type='ShaderNodeShaderToRGB') 67 | 68 | diffuse = nodes.new(type='ShaderNodeBsdfDiffuse') 69 | 70 | colorramp1 = nodes.new(type='ShaderNodeValToRGB') 71 | colorramp1.color_ramp.interpolation = 'CONSTANT' 72 | colorramp1.color_ramp.elements.new(0.5) 73 | colorramp1.color_ramp.elements[0].position = 0 74 | colorramp1.color_ramp.elements[1].position = 0.86 75 | colorramp1.color_ramp.elements[2].position = 0.88 76 | colorramp1.color_ramp.elements[0].color = (1.0, 1.0, 1.0, 1.000000) 77 | colorramp1.color_ramp.elements[1].color = (0.0, 0.0, 0.0, 1.000000) 78 | colorramp1.color_ramp.elements[2].color = (1.0, 1.0, 1.0, 1.0) 79 | 80 | noise = nodes.new(type='ShaderNodeTexNoise') 81 | noise.inputs[2].default_value = 1000 82 | noise.inputs[3].default_value = 15 83 | noise.inputs[4].default_value = 0 84 | 85 | links = sandmat.node_tree.links 86 | 87 | links.new(translucent.outputs[0], output.inputs[0]) 88 | links.new(normal.outputs[0], translucent.inputs[1]) 89 | links.new(multiply.outputs[0], translucent.inputs[0]) 90 | links.new(colorramp0.outputs[0], multiply.inputs[1]) 91 | links.new(shadertorgb.outputs[0], colorramp0.inputs[0]) 92 | links.new(diffuse.outputs[0], shadertorgb.inputs[0]) 93 | 94 | links.new(colorramp1.outputs[0], multiply.inputs[2]) 95 | links.new(noise.outputs[0], colorramp1.inputs[0]) 96 | 97 | bpy.context.object.data.materials.append(sandmat) 98 | 99 | 100 | class OBJECT_OT_generateSandPlane(bpy.types.Operator): 101 | """Create a stylized sand plane""" 102 | bl_idname = "mesh.generate_sand_plane" 103 | bl_label = "Add Stylized Sand Dunes" 104 | bl_options = {'REGISTER', 'UNDO'} 105 | 106 | def execute(self, context): 107 | 108 | generateSandPlane() 109 | assignDrivers() 110 | 111 | return {'FINISHED'} 112 | -------------------------------------------------------------------------------- /GroundPlanes/StonePathPlane.py: -------------------------------------------------------------------------------- 1 | # Stone Path Plane Generator 2 | import bpy 3 | 4 | from .Drivers.StonePathPlaneDrivers import * 5 | 6 | def generateStonePathPlane(): 7 | 8 | bpy.ops.mesh.primitive_plane_add(size=2, enter_editmode=False, align='WORLD', location=(0, 0, 0), scale=(1, 1, 1)) 9 | stonepath = bpy.context.object 10 | stonepath.name = 'StonePath' 11 | bpy.ops.object.shade_smooth() 12 | 13 | bpy.ops.object.modifier_add(type='ARRAY') 14 | array_x = stonepath.modifiers['Array'] 15 | array_x.count = 1 16 | 17 | bpy.ops.object.modifier_add(type='ARRAY') 18 | array_y = stonepath.modifiers['Array.001'] 19 | array_y.count = 1 20 | array_y.relative_offset_displace[0] = 0 21 | array_y.relative_offset_displace[1] = 1 22 | 23 | bpy.ops.object.modifier_add(type='SUBSURF') 24 | subsurf = stonepath.modifiers["Subdivision"] 25 | subsurf.levels = 2 26 | subsurf.render_levels = 2 27 | subsurf.subdivision_type = 'SIMPLE' 28 | 29 | 30 | stonepathmat = bpy.data.materials.new(name='stonepathmaterial') 31 | stonepathmat.use_nodes = True 32 | stonepathmat.node_tree.nodes.clear() 33 | 34 | nodes = stonepathmat.node_tree.nodes 35 | 36 | output = nodes.new(type='ShaderNodeOutputMaterial') 37 | 38 | # Translucent & Normal Node 39 | translucent = nodes.new(type='ShaderNodeBsdfTranslucent') 40 | normal = nodes.new(type='ShaderNodeNormal') 41 | normal.outputs[0].default_value = (0, 0, -1) 42 | # Ends 43 | 44 | colorramp0 = nodes.new(type='ShaderNodeValToRGB') 45 | colorramp0.color_ramp.interpolation = 'B_SPLINE' 46 | colorramp0.color_ramp.elements.new(0.5) 47 | colorramp0.color_ramp.elements[0].color = [0.016370, 0.068727, 0.016674, 1.000000] 48 | colorramp0.color_ramp.elements[1].color = [0.076728, 0.076728, 0.076728, 1.000000] 49 | colorramp0.color_ramp.elements[2].color = [0.571661, 0.571661, 0.571661, 1.000000] 50 | colorramp0.color_ramp.elements[0].position = 0.0 51 | colorramp0.color_ramp.elements[1].position = 0.05 52 | colorramp0.color_ramp.elements[2].position = 1.0 53 | 54 | shadertorgb = nodes.new(type='ShaderNodeShaderToRGB') 55 | 56 | diffuse = nodes.new(type='ShaderNodeBsdfDiffuse') 57 | 58 | multiply0 = nodes.new(type='ShaderNodeMixRGB') 59 | multiply0.blend_type = 'MULTIPLY' 60 | multiply0.inputs[0].default_value = 1 61 | 62 | multiply1 = nodes.new(type='ShaderNodeMixRGB') 63 | multiply1.blend_type = 'MULTIPLY' 64 | multiply1.inputs[0].default_value = 1 65 | multiply1.inputs[2].default_value = [0.154261, 0.154261, 0.154261, 1.000000] 66 | 67 | voronoi0 = nodes.new(type='ShaderNodeTexVoronoi') 68 | voronoi0.feature = 'DISTANCE_TO_EDGE' 69 | voronoi0.inputs[2].default_value = 3 70 | 71 | noise0 = nodes.new(type='ShaderNodeTexNoise') 72 | noise0.inputs[2].default_value = 10 73 | 74 | noise1 = nodes.new(type='ShaderNodeTexNoise') 75 | noise1.inputs[2].default_value = 1 76 | noise1.inputs[3].default_value = 15 77 | 78 | mapping0 = nodes.new(type='ShaderNodeMapping') 79 | 80 | mapping1 = nodes.new(type='ShaderNodeMapping') 81 | 82 | texcoord = nodes.new(type='ShaderNodeTexCoord') 83 | 84 | links = stonepathmat.node_tree.links 85 | 86 | links.new(translucent.outputs[0], output.inputs[0]) 87 | links.new(normal.outputs[0], translucent.inputs[1]) 88 | links.new(colorramp0.outputs[0], translucent.inputs[0]) 89 | links.new(shadertorgb.outputs[0], colorramp0.inputs[0]) 90 | links.new(diffuse.outputs[0], shadertorgb.inputs[0]) 91 | 92 | links.new(multiply0.outputs[0], diffuse.inputs[0]) 93 | links.new(noise0.outputs[0], multiply0.inputs[1]) 94 | links.new(mapping1.outputs[0], noise0.inputs[0]) 95 | links.new(texcoord.outputs[0], mapping1.inputs[0]) 96 | 97 | links.new(voronoi0.outputs[0], multiply0.inputs[2]) 98 | links.new(mapping0.outputs[0], voronoi0.inputs[0]) 99 | links.new(mapping1.outputs[0], mapping0.inputs[0]) 100 | links.new(multiply1.outputs[0], mapping0.inputs[1]) 101 | links.new(noise1.outputs[0], multiply1.inputs[1]) 102 | links.new(texcoord.outputs[0], noise1.inputs[0]) 103 | 104 | bpy.context.object.data.materials.append(stonepathmat) 105 | 106 | 107 | class OBJECT_OT_generateStonePathPlane(bpy.types.Operator): 108 | """Create a stylized stone path plane""" 109 | bl_idname = "mesh.generate_stone_path_plane" 110 | bl_label = "Add Stylized Stone Path" 111 | bl_options = {'REGISTER', 'UNDO'} 112 | 113 | def execute(self, context): 114 | 115 | generateStonePathPlane() 116 | assignDrivers() 117 | 118 | return {'FINISHED'} 119 | -------------------------------------------------------------------------------- /GroundPlanes/WaterPlanes.py: -------------------------------------------------------------------------------- 1 | # Water Planes 2 | import bpy 3 | 4 | from .Drivers.WaterPlanesDrivers import * 5 | 6 | def generateWaterPlanes(): 7 | 8 | bpy.ops.mesh.primitive_plane_add(size=2, enter_editmode=False, align='WORLD', location=(0, 0, 0), scale=(1, 1, 1)) 9 | surfaceplane = bpy.context.object 10 | surfaceplane.name = 'SurfacePlane' 11 | bpy.ops.object.shade_smooth() 12 | 13 | bpy.ops.object.modifier_add(type='ARRAY') 14 | array_x = surfaceplane.modifiers['Array'] 15 | array_x.count = 1 16 | 17 | bpy.ops.object.modifier_add(type='ARRAY') 18 | array_y = surfaceplane.modifiers['Array.001'] 19 | array_y.count = 1 20 | array_y.relative_offset_displace[0] = 0 21 | array_y.relative_offset_displace[1] = 1 22 | 23 | bpy.ops.object.modifier_add(type='SUBSURF') 24 | subsurf = surfaceplane.modifiers["Subdivision"] 25 | subsurf.levels = 4 26 | subsurf.render_levels = 4 27 | subsurf.subdivision_type = 'SIMPLE' 28 | 29 | watertex = bpy.data.textures.new(name='WaterClouds', type = 'CLOUDS') 30 | watertex.noise_depth = 6 31 | 32 | bpy.ops.object.modifier_add(type='DISPLACE') 33 | displace = surfaceplane.modifiers["Displace"] 34 | displace.texture_coords = 'GLOBAL' 35 | displace.strength = 0.1 36 | displace.texture = watertex 37 | 38 | bpy.ops.mesh.primitive_plane_add(size=2, enter_editmode=False, align='WORLD', location=(0, 0, -0.2), scale=(1, 1, 1)) 39 | bottomplane = bpy.context.object 40 | bottomplane.name = 'BottomPlane' 41 | bpy.ops.object.shade_smooth() 42 | 43 | bpy.ops.object.modifier_add(type='ARRAY') 44 | array_x = bottomplane.modifiers['Array'] 45 | array_x.count = 1 46 | 47 | bpy.ops.object.modifier_add(type='ARRAY') 48 | array_y = bottomplane.modifiers['Array.001'] 49 | array_y.count = 1 50 | array_y.relative_offset_displace[0] = 0 51 | array_y.relative_offset_displace[1] = 1 52 | 53 | surfacemat = bpy.data.materials.new(name='SurfaceMaterial') 54 | surfacemat.use_nodes = True 55 | surfacemat.node_tree.nodes.clear() 56 | surfacemat.blend_method = 'BLEND' 57 | surfacemat.shadow_method = 'NONE' 58 | 59 | nodes = surfacemat.node_tree.nodes 60 | 61 | output = nodes.new(type='ShaderNodeOutputMaterial') 62 | 63 | mixshader = nodes.new(type='ShaderNodeMixShader') 64 | 65 | transparent = nodes.new(type='ShaderNodeBsdfTransparent') 66 | transparent.inputs[0].default_value = (0.25, 0.25, 1, 1) 67 | 68 | # Translucent & Normal Node 69 | translucent = nodes.new(type='ShaderNodeBsdfTranslucent') 70 | normal = nodes.new(type='ShaderNodeNormal') 71 | normal.outputs[0].default_value = (0, 0, -1) 72 | # Ends 73 | 74 | colorramp1 = nodes.new(type='ShaderNodeValToRGB') 75 | colorramp1.color_ramp.elements.new(0.5) 76 | colorramp1.color_ramp.elements[0].position = 0 77 | colorramp1.color_ramp.elements[1].position = 0.25 78 | colorramp1.color_ramp.elements[2].position = 0.5 79 | colorramp1.color_ramp.elements[0].color = (0.000000, 0.005409, 0.205264, 1.000000) 80 | colorramp1.color_ramp.elements[1].color = (0.220020, 0.346031, 0.602632, 1.000000) 81 | colorramp1.color_ramp.elements[2].color = (1, 1, 1, 1) 82 | 83 | colorramp2 = nodes.new(type='ShaderNodeValToRGB') 84 | colorramp2.color_ramp.elements[0].position = 0.1 85 | colorramp2.color_ramp.elements[1].position = 0.2 86 | colorramp2.color_ramp.elements[0].color = (1, 1, 1, 1) 87 | colorramp2.color_ramp.elements[1].color = (0, 0, 0, 1) 88 | 89 | subtract = nodes.new(type='ShaderNodeMath') 90 | subtract.operation = 'SUBTRACT' 91 | 92 | voronoi1 = nodes.new(type='ShaderNodeTexVoronoi') 93 | voronoi1.voronoi_dimensions = '2D' 94 | voronoi1.inputs[2].default_value = 20 95 | voronoi2 = nodes.new(type='ShaderNodeTexVoronoi') 96 | voronoi2.voronoi_dimensions = '2D' 97 | voronoi2.feature = 'SMOOTH_F1' 98 | voronoi2.inputs[2].default_value = 20 99 | 100 | mapping1 = nodes.new(type='ShaderNodeMapping') 101 | 102 | combinexyz = nodes.new(type='ShaderNodeCombineXYZ') 103 | 104 | separatexyz = nodes.new(type='ShaderNodeSeparateXYZ') 105 | 106 | texcoord1 = nodes.new(type='ShaderNodeTexCoord') 107 | 108 | musgrave1 = nodes.new(type='ShaderNodeTexMusgrave') 109 | musgrave1.inputs[2].default_value = 50 110 | musgrave1.inputs[3].default_value = 0.005 111 | mapping2 = nodes.new(type='ShaderNodeMapping') 112 | texcoord2 = nodes.new(type='ShaderNodeTexCoord') 113 | add1 = nodes.new(type='ShaderNodeMath') 114 | 115 | musgrave2 = nodes.new(type='ShaderNodeTexMusgrave') 116 | musgrave2.inputs[2].default_value = 10 117 | musgrave2.inputs[3].default_value = 0.02 118 | mapping3 = nodes.new(type='ShaderNodeMapping') 119 | texcoord3 = nodes.new(type='ShaderNodeTexCoord') 120 | add2 = nodes.new(type='ShaderNodeMath') 121 | 122 | links = surfacemat.node_tree.links 123 | 124 | links.new(mixshader.outputs[0], output.inputs[0]) 125 | 126 | links.new(translucent.outputs[0], mixshader.inputs[1]) 127 | 128 | links.new(transparent.outputs[0], mixshader.inputs[2]) 129 | 130 | links.new(colorramp2.outputs[0], mixshader.inputs[0]) 131 | 132 | links.new(colorramp1.outputs[0], translucent.inputs[0]) 133 | 134 | links.new(normal.outputs[0], translucent.inputs[1]) 135 | 136 | links.new(subtract.outputs[0], colorramp2.inputs[0]) 137 | 138 | links.new(voronoi1.outputs[0], subtract.inputs[0]) 139 | links.new(voronoi2.outputs[0], subtract.inputs[1]) 140 | 141 | links.new(mapping1.outputs[0], voronoi1.inputs[0]) 142 | links.new(mapping1.outputs[0], voronoi2.inputs[0]) 143 | 144 | links.new(combinexyz.outputs[0], mapping1.inputs[0]) 145 | 146 | links.new(separatexyz.outputs[0], combinexyz.inputs[0]) 147 | links.new(separatexyz.outputs[2], combinexyz.inputs[2]) 148 | links.new(texcoord1.outputs[0], separatexyz.inputs[0]) 149 | 150 | links.new(add1.outputs[0], combinexyz.inputs[1]) 151 | 152 | links.new(musgrave1.outputs[0], add1.inputs[1]) 153 | links.new(mapping2.outputs[0], musgrave1.inputs[0]) 154 | links.new(texcoord2.outputs[0], mapping2.inputs[0]) 155 | 156 | links.new(add2.outputs[0], add1.inputs[0]) 157 | links.new(musgrave2.outputs[0], add2.inputs[1]) 158 | links.new(mapping3.outputs[0], musgrave2.inputs[0]) 159 | links.new(texcoord3.outputs[0], mapping3.inputs[0]) 160 | 161 | links.new(separatexyz.outputs[1], add2.inputs[0]) 162 | 163 | surfaceplane.data.materials.append(surfacemat) 164 | 165 | # # Create Custom Properties 166 | # object = surfaceplane 167 | 168 | # property1 = 'ExtendX' 169 | # property2 = 'ExtendY' 170 | # value = 1 171 | 172 | # object[property1] = value 173 | 174 | # edit_property = object.id_properties_ui(property1) 175 | # edit_property.update( 176 | # #subtype='COLOR', 177 | # min=1, 178 | # max=100, 179 | # description='', 180 | # #soft_min=0, 181 | # #soft_max=1, 182 | # ) 183 | 184 | # object[property2] = value 185 | 186 | # edit_property = object.id_properties_ui(property2) 187 | # edit_property.update( 188 | # #subtype='COLOR', 189 | # min=1, 190 | # max=100, 191 | # description='', 192 | # #soft_min=0, 193 | # #soft_max=1, 194 | # ) 195 | # # Assign Drivers 196 | # driven_value = "count" 197 | 198 | # driven_object = bpy.data.objects['SurfacePlane'].modifiers['Array'] 199 | 200 | # driver = driven_object.driver_add(driven_value) 201 | 202 | # var = driver.driver.variables.new() 203 | # var.name = 'var' 204 | # var.targets[0].id_type = 'OBJECT' 205 | # var.targets[0].id = bpy.data.objects['SurfacePlane'] 206 | # var.targets[0].data_path = '["ExtendX"]' 207 | 208 | # driver.driver.expression = var.name 209 | 210 | # driven_value = "count" 211 | 212 | # driven_object = bpy.data.objects['SurfacePlane'].modifiers['Array.001'] 213 | 214 | # driver = driven_object.driver_add(driven_value) 215 | 216 | # var = driver.driver.variables.new() 217 | # var.name = 'var' 218 | # var.targets[0].id_type = 'OBJECT' 219 | # var.targets[0].id = bpy.data.objects['SurfacePlane'] 220 | # var.targets[0].data_path = '["ExtendY"]' 221 | 222 | # driver.driver.expression = var.name 223 | 224 | bottommat = bpy.data.materials.new(name='BottomMaterial') 225 | bottommat.use_nodes = True 226 | bottommat.node_tree.nodes.clear() 227 | 228 | nodes = bottommat.node_tree.nodes 229 | 230 | output = nodes.new(type='ShaderNodeOutputMaterial') 231 | 232 | # Translucent & Normal Node 233 | translucent = nodes.new(type='ShaderNodeBsdfTranslucent') 234 | normal = nodes.new(type='ShaderNodeNormal') 235 | normal.outputs[0].default_value = (0, 0, -1) 236 | # Ends 237 | 238 | colorramp = nodes.new(type='ShaderNodeValToRGB') 239 | colorramp.color_ramp.elements[0].position = 0 240 | colorramp.color_ramp.elements[1].position = 0.25 241 | colorramp.color_ramp.elements[0].color = (0.028821, 0.052685, 0.215383, 1.000000) 242 | colorramp.color_ramp.elements[1].color = (0.000000, 0.001229, 0.034772, 1.000000) 243 | 244 | subtract = nodes.new(type='ShaderNodeMath') 245 | subtract.operation = 'SUBTRACT' 246 | 247 | voronoi1 = nodes.new(type='ShaderNodeTexVoronoi') 248 | voronoi1.voronoi_dimensions = '2D' 249 | voronoi1.inputs[2].default_value = 20 250 | voronoi2 = nodes.new(type='ShaderNodeTexVoronoi') 251 | voronoi2.voronoi_dimensions = '2D' 252 | voronoi2.feature = 'SMOOTH_F1' 253 | voronoi2.inputs[2].default_value = 20 254 | 255 | mapping1 = nodes.new(type='ShaderNodeMapping') 256 | 257 | combinexyz = nodes.new(type='ShaderNodeCombineXYZ') 258 | 259 | separatexyz = nodes.new(type='ShaderNodeSeparateXYZ') 260 | 261 | texcoord1 = nodes.new(type='ShaderNodeTexCoord') 262 | 263 | musgrave1 = nodes.new(type='ShaderNodeTexMusgrave') 264 | musgrave1.inputs[2].default_value = 50 265 | musgrave1.inputs[3].default_value = 0.005 266 | mapping2 = nodes.new(type='ShaderNodeMapping') 267 | texcoord2 = nodes.new(type='ShaderNodeTexCoord') 268 | add1 = nodes.new(type='ShaderNodeMath') 269 | 270 | musgrave2 = nodes.new(type='ShaderNodeTexMusgrave') 271 | musgrave2.inputs[2].default_value = 10 272 | musgrave2.inputs[3].default_value = 0.02 273 | mapping3 = nodes.new(type='ShaderNodeMapping') 274 | texcoord3 = nodes.new(type='ShaderNodeTexCoord') 275 | add2 = nodes.new(type='ShaderNodeMath') 276 | 277 | links = bottommat.node_tree.links 278 | 279 | links.new(translucent.outputs[0], output.inputs[0]) 280 | 281 | links.new(colorramp.outputs[0], translucent.inputs[0]) 282 | 283 | links.new(normal.outputs[0], translucent.inputs[1]) 284 | 285 | links.new(subtract.outputs[0], colorramp.inputs[0]) 286 | 287 | links.new(voronoi1.outputs[0], subtract.inputs[0]) 288 | links.new(voronoi2.outputs[0], subtract.inputs[1]) 289 | 290 | links.new(mapping1.outputs[0], voronoi1.inputs[0]) 291 | links.new(mapping1.outputs[0], voronoi2.inputs[0]) 292 | 293 | links.new(combinexyz.outputs[0], mapping1.inputs[0]) 294 | 295 | links.new(separatexyz.outputs[0], combinexyz.inputs[0]) 296 | links.new(separatexyz.outputs[2], combinexyz.inputs[2]) 297 | links.new(texcoord1.outputs[0], separatexyz.inputs[0]) 298 | 299 | links.new(add1.outputs[0], combinexyz.inputs[1]) 300 | 301 | links.new(musgrave1.outputs[0], add1.inputs[1]) 302 | links.new(mapping2.outputs[0], musgrave1.inputs[0]) 303 | links.new(texcoord2.outputs[0], mapping2.inputs[0]) 304 | 305 | links.new(add2.outputs[0], add1.inputs[0]) 306 | links.new(musgrave2.outputs[0], add2.inputs[1]) 307 | links.new(mapping3.outputs[0], musgrave2.inputs[0]) 308 | links.new(texcoord3.outputs[0], mapping3.inputs[0]) 309 | 310 | links.new(separatexyz.outputs[1], add2.inputs[0]) 311 | 312 | bottomplane.data.materials.append(bottommat) 313 | 314 | surfaceplane = bpy.data.objects['SurfacePlane'] 315 | bottomplane = bpy.data.objects['BottomPlane'] 316 | 317 | bottomplane.parent = surfaceplane 318 | 319 | 320 | # # Assign Drivers 321 | # driven_value = "count" 322 | 323 | # driven_object = bpy.context.object.modifiers['Array'] 324 | 325 | # driver = driven_object.driver_add(driven_value) 326 | 327 | # var = driver.driver.variables.new() 328 | # var.name = 'var' 329 | # var.targets[0].id_type = 'OBJECT' 330 | # var.targets[0].id = bpy.data.objects['SurfacePlane'] 331 | # var.targets[0].data_path = '["ExtendX"]' 332 | 333 | # driver.driver.expression = var.name 334 | 335 | # driven_value = "count" 336 | 337 | # driven_object = bpy.context.object.modifiers['Array.001'] 338 | 339 | # driver = driven_object.driver_add(driven_value) 340 | 341 | # var = driver.driver.variables.new() 342 | # var.name = 'var' 343 | # var.targets[0].id_type = 'OBJECT' 344 | # var.targets[0].id = bpy.data.objects['SurfacePlane'] 345 | # var.targets[0].data_path = '["ExtendY"]' 346 | 347 | # driver.driver.expression = var.name 348 | 349 | 350 | class OBJECT_OT_generateWaterPlanes(bpy.types.Operator): 351 | """Create a stylized water planes""" 352 | bl_idname = "mesh.generate_water_planes" 353 | bl_label = "Add Stylized Water Planes" 354 | bl_options = {'REGISTER', 'UNDO'} 355 | 356 | def execute(self, context): 357 | 358 | generateWaterPlanes() 359 | assignDrivers() 360 | 361 | return {'FINISHED'} 362 | -------------------------------------------------------------------------------- /Objects/Drivers/RockDrivers.py: -------------------------------------------------------------------------------- 1 | # Assign Drivers to the Rock 2 | import bpy 3 | 4 | def assignDrivers(): 5 | 6 | drivers = [] 7 | 8 | object = bpy.context.object 9 | 10 | # Rock Color - Red Channel 11 | d0 = { 12 | 'object': object, 13 | 'property': 'RockColor', 14 | 'value': [0.100000, 0.200000, 0.300000, 1.000000], 15 | 'driven_value': 'nodes["Mix"].inputs[2].default_value', 16 | 'driven_object' : object.material_slots[0].material.node_tree, 17 | 'index' : 0, 18 | 'variable_name' : 'var', 19 | 'data_path' : '["RockColor"][0]', 20 | 'id_type' : 'OBJECT', 21 | 'subtype': 'COLOR', 22 | 'min': 0, 23 | 'max': 1, 24 | } 25 | 26 | drivers.append(d0) 27 | 28 | # Rock Color - Green Channel 29 | d1 = { 30 | 'object': object, 31 | 'property': 'RockColor', 32 | 'value': [0.100000, 0.200000, 0.300000, 1.000000], 33 | 'driven_value': 'nodes["Mix"].inputs[2].default_value', 34 | 'driven_object' : object.material_slots[0].material.node_tree, 35 | 'index' : 1, 36 | 'variable_name' : 'var', 37 | 'data_path' : '["RockColor"][1]', 38 | 'id_type' : 'OBJECT', 39 | 'subtype': 'COLOR', 40 | 'min': 0, 41 | 'max': 1, 42 | } 43 | 44 | drivers.append(d1) 45 | 46 | # Rock Color - Blue Channel 47 | d2 = { 48 | 'object': object, 49 | 'property': 'RockColor', 50 | 'value': [0.100000, 0.200000, 0.300000, 1.000000], 51 | 'driven_value': 'nodes["Mix"].inputs[2].default_value', 52 | 'driven_object' : object.material_slots[0].material.node_tree, 53 | 'index' : 2, 54 | 'variable_name' : 'var', 55 | 'data_path' : '["RockColor"][2]', 56 | 'id_type' : 'OBJECT', 57 | 'subtype': 'COLOR', 58 | 'min': 0, 59 | 'max': 1, 60 | } 61 | 62 | drivers.append(d2) 63 | 64 | # # Pattern Mix - Red Channel 65 | d3 = { 66 | 'object': object, 67 | 'property': 'PatternMix', 68 | 'value': 1.0, 69 | 'driven_value': 'nodes["Mix.004"].inputs[2].default_value', 70 | 'driven_object' : object.material_slots[0].material.node_tree, 71 | 'index' : 0, 72 | 'variable_name' : 'var', 73 | 'data_path' : '["PatternMix"]', #[0] 74 | 'id_type' : 'OBJECT', 75 | 'subtype': '', 76 | 'min': 0, 77 | 'max': 1, 78 | } 79 | 80 | drivers.append(d3) 81 | 82 | # Pattern Mix - Green Channel 83 | d4 = { 84 | 'object': object, 85 | 'property': 'PatternMix', 86 | 'value': 1.0, 87 | 'driven_value': 'nodes["Mix.004"].inputs[2].default_value', 88 | 'driven_object' : object.material_slots[0].material.node_tree, 89 | 'index' : 1, 90 | 'variable_name' : 'var', 91 | 'data_path' : '["PatternMix"]', #[1] 92 | 'id_type' : 'OBJECT', 93 | 'subtype': '', 94 | 'min': 0, 95 | 'max': 1, 96 | } 97 | 98 | drivers.append(d4) 99 | 100 | # Pattern Mix - Blue Channel 101 | d5 = { 102 | 'object': object, 103 | 'property': 'PatternMix', 104 | 'value': 1.0, 105 | 'driven_value': 'nodes["Mix.004"].inputs[2].default_value', 106 | 'driven_object' : object.material_slots[0].material.node_tree, 107 | 'index' : 2, 108 | 'variable_name' : 'var', 109 | 'data_path' : '["PatternMix"]', #[2] 110 | 'id_type' : 'OBJECT', 111 | 'subtype': '', 112 | 'min': 0, 113 | 'max': 1, 114 | } 115 | 116 | drivers.append(d5) 117 | 118 | # # Brightness 119 | # bpy.data.materials["RockMaterial"].node_tree.nodes["Bright/Contrast"].inputs[1].default_value 120 | d6 = { 121 | 'object': object, 122 | 'property': 'Brightness', 123 | 'value': -0.1, 124 | 'driven_value': 'nodes["Bright/Contrast"].inputs[1].default_value', 125 | 'driven_object' : object.material_slots[0].material.node_tree, 126 | 'index' : -1, 127 | 'variable_name' : 'var', 128 | 'data_path' : '["Brightness"]', 129 | 'id_type' : 'OBJECT', 130 | 'subtype': '', 131 | 'min': -10, 132 | 'max': 10, 133 | } 134 | 135 | drivers.append(d6) 136 | 137 | # # Contrast 138 | # bpy.data.materials["RockMaterial"].node_tree.nodes["Bright/Contrast"].inputs[2].default_value 139 | d7 = { 140 | 'object': object, 141 | 'property': 'Contrast', 142 | 'value': 1.0, 143 | 'driven_value': 'nodes["Bright/Contrast"].inputs[2].default_value', 144 | 'driven_object' : object.material_slots[0].material.node_tree, 145 | 'index' : -1, 146 | 'variable_name' : 'var', 147 | 'data_path' : '["Contrast"]', 148 | 'id_type' : 'OBJECT', 149 | 'subtype': '', 150 | 'min': 0, 151 | 'max': 10, 152 | } 153 | 154 | drivers.append(d7) 155 | 156 | # # Rock Displace Strength 157 | d8 = { 158 | 'object': object, 159 | 'property': 'DisplaceStrength', 160 | 'value': 0.5, 161 | 'driven_value': 'strength', 162 | 'driven_object' : object.modifiers["Displace"], 163 | 'index' : -1, 164 | 'variable_name' : 'var', 165 | 'data_path' : '["DisplaceStrength"]', 166 | 'id_type' : 'OBJECT', 167 | 'subtype': '', 168 | 'min': -100, 169 | 'max': 100, 170 | } 171 | 172 | drivers.append(d8) 173 | 174 | 175 | # # Main Pattern Scale 176 | # bpy.data.materials["RockMaterial"].node_tree.nodes["Voronoi Texture"].inputs[2].default_value 177 | d9 = { 178 | 'object': object, 179 | 'property': 'MainPatternScale', 180 | 'value': 5.0, 181 | 'driven_value': 'nodes["Voronoi Texture"].inputs[2].default_value', 182 | 'driven_object' : object.material_slots[0].material.node_tree, 183 | 'index' : -1, 184 | 'variable_name' : 'var', 185 | 'data_path' : '["MainPatternScale"]', 186 | 'id_type' : 'OBJECT', 187 | 'subtype': '', 188 | 'min': -100, 189 | 'max': 100, 190 | } 191 | 192 | drivers.append(d9) 193 | 194 | # # Distortion Pattern Scale 195 | # bpy.data.materials["RockMaterial"].node_tree.nodes["Voronoi Texture.001"].inputs[2].default_value 196 | d10 = { 197 | 'object': object, 198 | 'property': 'DistortionScale', 199 | 'value': 5.0, 200 | 'driven_value': 'nodes["Voronoi Texture.001"].inputs[2].default_value', 201 | 'driven_object' : object.material_slots[0].material.node_tree, 202 | 'index' : -1, 203 | 'variable_name' : 'var', 204 | 'data_path' : '["DistortionScale"]', 205 | 'id_type' : 'OBJECT', 206 | 'subtype': '', 207 | 'min': -100, 208 | 'max': 100, 209 | } 210 | 211 | drivers.append(d10) 212 | 213 | 214 | 215 | for d in drivers: 216 | d['object'][d['property']] = d['value'] 217 | 218 | edit_property = d['object'].id_properties_ui(d['property']) 219 | edit_property.update(min=d['min'], max=d['max']) 220 | 221 | if d['subtype']: 222 | edit_property.update(subtype=d['subtype']) 223 | 224 | driver = d['driven_object'].driver_add(d['driven_value'], d['index']) 225 | 226 | variable = driver.driver.variables.new() 227 | variable.name = d['variable_name'] 228 | variable.targets[0].id_type = d['id_type'] 229 | variable.targets[0].id = d['object'] 230 | variable.targets[0].data_path = d['data_path'] 231 | 232 | driver.driver.expression = variable.name 233 | 234 | # Update Driver Dependencies 235 | d['object'].hide_render = d['object'].hide_render 236 | -------------------------------------------------------------------------------- /Objects/ElectricArcSphere.py: -------------------------------------------------------------------------------- 1 | # Creating Electricity Sphere 2 | import bpy 3 | 4 | #from .Drivers.RockDrivers import * 5 | 6 | def generateElectricArcSphere(): 7 | 8 | bpy.ops.mesh.primitive_uv_sphere_add(radius=1, location=(0, 0, 0), scale=(1, 1, 1)) 9 | bpy.ops.object.shade_smooth() 10 | electricarc = bpy.context.object 11 | 12 | electricarctex = bpy.data.textures.new(name='ElectricityClouds', type = 'CLOUDS') 13 | 14 | bpy.ops.object.modifier_add(type='SUBSURF') 15 | subsurf = electricarc.modifiers["Subdivision"] 16 | subsurf.levels = 2 17 | subsurf.render_levels = 2 18 | 19 | bpy.ops.object.modifier_add(type='SHRINKWRAP') 20 | shrinkwrap = electricarc.modifiers["Shrinkwrap"] 21 | shrinkwrap.offset = 0.2 22 | 23 | bpy.ops.object.modifier_add(type='DISPLACE') 24 | displace = electricarc.modifiers["Displace"] 25 | displace.texture_coords = 'GLOBAL' 26 | displace.strength = 0.5 27 | displace.texture = electricarctex 28 | 29 | bpy.ops.object.modifier_add(type='SUBSURF') 30 | subsurf1 = electricarc.modifiers["Subdivision.001"] 31 | subsurf1.levels = 2 32 | subsurf1.render_levels = 2 33 | 34 | energyspheremat = bpy.data.materials.new(name='energyspherematerial') 35 | energyspheremat.use_nodes = True 36 | energyspheremat.blend_method = 'BLEND' 37 | energyspheremat.shadow_method = 'NONE' 38 | energyspheremat.node_tree.nodes.clear() 39 | 40 | nodes = energyspheremat.node_tree.nodes 41 | 42 | output = nodes.new(type='ShaderNodeOutputMaterial') 43 | 44 | mixshader = nodes.new(type='ShaderNodeMixShader') 45 | 46 | transparent = nodes.new(type='ShaderNodeBsdfTransparent') 47 | 48 | emission = nodes.new(type='ShaderNodeEmission') 49 | emission.inputs[0].default_value = [0.032494, 0.249981, 1.000000, 1.000000] 50 | emission.inputs[1].default_value = 50 51 | 52 | invert = nodes.new(type='ShaderNodeInvert') 53 | 54 | colorramp0 = nodes.new(type='ShaderNodeValToRGB') 55 | colorramp0.color_ramp.interpolation = 'CONSTANT' 56 | colorramp0.color_ramp.elements[0].position = 0.0 57 | colorramp0.color_ramp.elements[1].position = 0.95 58 | colorramp0.color_ramp.elements[0].color = [0.0, 0.000000, 0.000000, 1.000000] 59 | colorramp0.color_ramp.elements[1].color = [1.0, 1.0, 1.0, 1.0] 60 | 61 | wave = nodes.new(type='ShaderNodeTexWave') 62 | wave.bands_direction = 'Z' 63 | wave.wave_profile = 'SAW' 64 | wave.inputs[1].default_value = 0.1 65 | wave.inputs[2].default_value = 20 66 | wave.inputs[3].default_value = 15 67 | 68 | wavemapping = nodes.new(type='ShaderNodeMapping') 69 | wavemapping.inputs[3].default_value = (1, 5, 3) 70 | 71 | texcoord = nodes.new(type='ShaderNodeTexCoord') 72 | 73 | links = energyspheremat.node_tree.links 74 | 75 | links.new(mixshader.outputs[0], output.inputs[0]) 76 | 77 | links.new(transparent.outputs[0], mixshader.inputs[2]) 78 | 79 | links.new(emission.outputs[0], mixshader.inputs[1]) 80 | links.new(colorramp0.outputs[0], invert.inputs[1]) 81 | links.new(invert.outputs[0], mixshader.inputs[0]) 82 | 83 | links.new(wave.outputs[0], colorramp0.inputs[0]) 84 | links.new(wavemapping.outputs[0], wave.inputs[0]) 85 | links.new(texcoord.outputs[3], wavemapping.inputs[0]) 86 | 87 | # bpy.ops.node.select_all(action='TOGGLE') 88 | # bpy.ops.node.button() 89 | 90 | bpy.context.object.data.materials.append(energyspheremat) 91 | 92 | 93 | class OBJECT_OT_generateElectricArcSphere(bpy.types.Operator): 94 | """Create an animated sphere of electricity""" 95 | bl_idname = "mesh.generate_electric_arc_sphere" 96 | bl_label = "Add Stylized Sphere of Electricity" 97 | bl_options = {'REGISTER', 'UNDO'} 98 | 99 | def execute(self, context): 100 | 101 | generateElectricArcSphere() 102 | #assignDrivers() 103 | 104 | return {'FINISHED'} 105 | -------------------------------------------------------------------------------- /Objects/EnergyRing.py: -------------------------------------------------------------------------------- 1 | # Creating Energy Ring 2 | import bpy 3 | 4 | #from .Drivers.RockDrivers import * 5 | 6 | def generateEnergyRing(): 7 | 8 | bpy.ops.mesh.primitive_cylinder_add(radius=2, depth=0.5, end_fill_type='NOTHING') 9 | bpy.ops.object.shade_smooth() 10 | 11 | bpy.ops.object.editmode_toggle() 12 | bpy.ops.mesh.select_all(action='DESELECT') 13 | 14 | bpy.ops.object.editmode_toggle() 15 | bpy.context.object.data.edges[0].select = True 16 | 17 | bpy.ops.object.editmode_toggle() 18 | bpy.ops.mesh.loop_multi_select(ring=False) 19 | bpy.ops.transform.resize(value=(0.5, 0.5, 0.5)) 20 | 21 | # 22 | 23 | bpy.ops.mesh.select_all(action='DESELECT') 24 | 25 | bpy.ops.object.editmode_toggle() 26 | bpy.context.object.data.edges[20].select = True 27 | 28 | bpy.ops.object.editmode_toggle() 29 | bpy.ops.mesh.loop_multi_select(ring=False) 30 | 31 | bpy.ops.object.vertex_group_add() 32 | bpy.ops.object.vertex_group_assign() 33 | 34 | bpy.ops.object.editmode_toggle() 35 | 36 | bpy.ops.object.modifier_add(type='SUBSURF') 37 | subsurf0 = bpy.context.object.modifiers["Subdivision"] 38 | subsurf0.levels = 2 39 | 40 | energytex = bpy.data.textures.new(name='Energy', type='CLOUDS') 41 | 42 | bpy.ops.object.modifier_add(type='DISPLACE') 43 | displace = bpy.context.object.modifiers['Displace'] 44 | displace.vertex_group = "Group" 45 | displace.direction = 'Z' 46 | displace.strength = 5 47 | displace.mid_level = 0 48 | displace.texture_coords = 'GLOBAL' 49 | displace.texture = energytex 50 | 51 | bpy.ops.object.modifier_add(type='SUBSURF') 52 | subsurf1 = bpy.context.object.modifiers["Subdivision.001"] 53 | subsurf1.levels = 2 54 | 55 | energyringmat = bpy.data.materials.new(name='energyringMaterial') 56 | energyringmat.use_nodes = True 57 | energyringmat.blend_method = 'BLEND' 58 | energyringmat.shadow_method = 'NONE' 59 | #energyringmat.show_transparent_back = False 60 | energyringmat.node_tree.nodes.clear() 61 | 62 | nodes = energyringmat.node_tree.nodes 63 | 64 | output = nodes.new(type='ShaderNodeOutputMaterial') 65 | 66 | mixshader = nodes.new(type='ShaderNodeMixShader') 67 | 68 | transparent = nodes.new(type='ShaderNodeBsdfTransparent') 69 | 70 | emission = nodes.new(type='ShaderNodeEmission') 71 | emission.inputs[1].default_value = 20 72 | 73 | colorramp0 = nodes.new(type='ShaderNodeValToRGB') 74 | colorramp0.color_ramp.interpolation = 'CONSTANT' 75 | colorramp0.color_ramp.elements.new(0.5) 76 | colorramp0.color_ramp.elements[0].position = 0.0 77 | colorramp0.color_ramp.elements[1].position = 0.06 78 | colorramp0.color_ramp.elements[2].position = 0.56 79 | colorramp0.color_ramp.elements[0].color = [0.0, 0.000000, 0.000000, 1.000000] 80 | colorramp0.color_ramp.elements[1].color = [0.055329, 0.055329, 0.055329, 1.000000] 81 | colorramp0.color_ramp.elements[2].color = [1.0, 1.0, 1.0, 1.0] 82 | 83 | multiply0 = nodes.new(type='ShaderNodeMixRGB') 84 | multiply0.blend_type = 'MULTIPLY' 85 | multiply0.inputs[0].default_value = 0.8 86 | 87 | multiply1 = nodes.new(type='ShaderNodeMixRGB') 88 | multiply1.blend_type = 'MULTIPLY' 89 | 90 | colorramp1 = nodes.new(type='ShaderNodeValToRGB') 91 | colorramp1.color_ramp.interpolation = 'CONSTANT' 92 | colorramp1.color_ramp.elements[0].color = [0.0, 0.0, 0.0, 1.0] 93 | colorramp1.color_ramp.elements[1].color = [1.0, 1.0, 1.0, 1.0] 94 | colorramp1.color_ramp.elements[0].position = 0.3 95 | colorramp1.color_ramp.elements[1].position = 0.4 96 | 97 | fresnel = nodes.new(type='ShaderNodeFresnel') 98 | 99 | voronoi = nodes.new(type='ShaderNodeTexVoronoi') 100 | 101 | voronoimapping = nodes.new(type='ShaderNodeMapping') 102 | voronoimapping.inputs[3].default_value = (20, 0.1, 1) 103 | 104 | wave = nodes.new(type='ShaderNodeTexWave') 105 | wave.bands_direction = 'Z' 106 | wave.wave_profile = 'SAW' 107 | wave.inputs[1].default_value = 0.2 108 | wave.inputs[2].default_value = 0.5 109 | 110 | wavemapping = nodes.new(type='ShaderNodeMapping') 111 | wavemapping.inputs[3].default_value = (1, 5, 3) 112 | 113 | gradient = nodes.new(type='ShaderNodeTexGradient') 114 | 115 | gradientmapping = nodes.new(type='ShaderNodeMapping') 116 | gradientmapping.inputs[2].default_value[1] = 1.5708 117 | 118 | texcoord = nodes.new(type='ShaderNodeTexCoord') 119 | 120 | links = energyringmat.node_tree.links 121 | 122 | links.new(mixshader.outputs[0], output.inputs[0]) 123 | 124 | links.new(transparent.outputs[0], mixshader.inputs[2]) 125 | 126 | links.new(emission.outputs[0], mixshader.inputs[1]) 127 | links.new(colorramp0.outputs[0], emission.inputs[0]) 128 | 129 | links.new(multiply0.outputs[0], colorramp0.inputs[0]) 130 | links.new(multiply1.outputs[0], multiply0.inputs[1]) 131 | 132 | links.new(fresnel.outputs[0], multiply1.inputs[2]) 133 | links.new(colorramp1.outputs[0], multiply0.inputs[2]) 134 | 135 | links.new(voronoi.outputs[0], colorramp1.inputs[0]) 136 | links.new(voronoimapping.outputs[0], voronoi.inputs[0]) 137 | links.new(texcoord.outputs[2], voronoimapping.inputs[0]) 138 | 139 | links.new(wave.outputs[0], multiply1.inputs[1]) 140 | links.new(wavemapping.outputs[0], wave.inputs[0]) 141 | links.new(texcoord.outputs[0], wavemapping.inputs[0]) 142 | 143 | links.new(gradient.outputs[0], mixshader.inputs[0]) 144 | links.new(gradientmapping.outputs[0], gradient.inputs[0]) 145 | links.new(texcoord.outputs[0], gradientmapping.inputs[0]) 146 | 147 | bpy.context.object.data.materials.append(energyringmat) 148 | 149 | 150 | class OBJECT_OT_generateEnergyRing(bpy.types.Operator): 151 | """Create an animated ring of energy""" 152 | bl_idname = "mesh.generate_energy_ring" 153 | bl_label = "Add Stylized Ring of Energy" 154 | bl_options = {'REGISTER', 'UNDO'} 155 | 156 | def execute(self, context): 157 | 158 | generateEnergyRing() 159 | #assignDrivers() 160 | 161 | return {'FINISHED'} 162 | -------------------------------------------------------------------------------- /Objects/EnergySphere.py: -------------------------------------------------------------------------------- 1 | # Creating PowerUp Sphere 2 | import bpy 3 | 4 | #from .Drivers.RockDrivers import * 5 | 6 | def generateEnergySphere(): 7 | 8 | bpy.ops.mesh.primitive_uv_sphere_add(radius=1, location=(0, 0, 0), scale=(1, 1, 1)) 9 | bpy.ops.object.shade_smooth() 10 | 11 | powerupspheremat = bpy.data.materials.new(name='powerupspherematerial') 12 | powerupspheremat.use_nodes = True 13 | powerupspheremat.blend_method = 'BLEND' 14 | powerupspheremat.shadow_method = 'NONE' 15 | #powerupspheremat.show_transparent_back = False 16 | powerupspheremat.node_tree.nodes.clear() 17 | 18 | nodes = powerupspheremat.node_tree.nodes 19 | 20 | output = nodes.new(type='ShaderNodeOutputMaterial') 21 | 22 | mixshader = nodes.new(type='ShaderNodeMixShader') 23 | 24 | transparent = nodes.new(type='ShaderNodeBsdfTransparent') 25 | 26 | emission = nodes.new(type='ShaderNodeEmission') 27 | emission.inputs[1].default_value = 20 28 | 29 | colorramp0 = nodes.new(type='ShaderNodeValToRGB') 30 | colorramp0.color_ramp.interpolation = 'CONSTANT' 31 | colorramp0.color_ramp.elements.new(0.5) 32 | colorramp0.color_ramp.elements[0].position = 0.0 33 | colorramp0.color_ramp.elements[1].position = 0.045 34 | colorramp0.color_ramp.elements[2].position = 0.068 35 | colorramp0.color_ramp.elements[0].color = [0.0, 0.000000, 0.000000, 1.000000] 36 | colorramp0.color_ramp.elements[1].color = [1.0, 1.0, 1.0, 1.0] 37 | colorramp0.color_ramp.elements[2].color = [0.055327, 0.055327, 0.055327, 1.000000] 38 | 39 | linearlight = nodes.new(type='ShaderNodeMixRGB') 40 | linearlight.blend_type = 'LINEAR_LIGHT' 41 | linearlight.inputs[0].default_value = 1.0 42 | 43 | fresnel = nodes.new(type='ShaderNodeFresnel') 44 | 45 | wave = nodes.new(type='ShaderNodeTexWave') 46 | wave.bands_direction = 'Z' 47 | wave.wave_profile = 'SAW' 48 | wave.inputs[1].default_value = 0.1 49 | wave.inputs[2].default_value = 10 50 | wave.inputs[3].default_value = 15 51 | 52 | wavemapping = nodes.new(type='ShaderNodeMapping') 53 | wavemapping.inputs[3].default_value = (1, 5, 3) 54 | 55 | gradient = nodes.new(type='ShaderNodeTexGradient') 56 | 57 | gradientmapping = nodes.new(type='ShaderNodeMapping') 58 | gradientmapping.inputs[2].default_value[1] = 1.5708 59 | 60 | texcoord = nodes.new(type='ShaderNodeTexCoord') 61 | 62 | links = powerupspheremat.node_tree.links 63 | 64 | links.new(mixshader.outputs[0], output.inputs[0]) 65 | 66 | links.new(transparent.outputs[0], mixshader.inputs[2]) 67 | 68 | links.new(emission.outputs[0], mixshader.inputs[1]) 69 | links.new(colorramp0.outputs[0], emission.inputs[0]) 70 | 71 | links.new(linearlight.outputs[0], colorramp0.inputs[0]) 72 | 73 | links.new(fresnel.outputs[0], linearlight.inputs[2]) 74 | 75 | links.new(texcoord.outputs[1], fresnel.inputs[1]) 76 | 77 | links.new(wave.outputs[0], linearlight.inputs[1]) 78 | links.new(wavemapping.outputs[0], wave.inputs[0]) 79 | links.new(texcoord.outputs[3], wavemapping.inputs[0]) 80 | 81 | links.new(gradient.outputs[0], mixshader.inputs[0]) 82 | links.new(gradientmapping.outputs[0], gradient.inputs[0]) 83 | links.new(texcoord.outputs[0], gradientmapping.inputs[0]) 84 | 85 | bpy.context.object.data.materials.append(powerupspheremat) 86 | 87 | 88 | class OBJECT_OT_generateEnergySphere(bpy.types.Operator): 89 | """Create an animated sphere of energy""" 90 | bl_idname = "mesh.generate_energy_sphere" 91 | bl_label = "Add Stylized Sphere of Energy" 92 | bl_options = {'REGISTER', 'UNDO'} 93 | 94 | def execute(self, context): 95 | 96 | generateEnergySphere() 97 | #assignDrivers() 98 | 99 | return {'FINISHED'} 100 | -------------------------------------------------------------------------------- /Objects/Explosion.py: -------------------------------------------------------------------------------- 1 | # explosion Cloud Generator 2 | import bpy 3 | 4 | #from .Drivers.explosionDrivers import * 5 | 6 | def generateExplosion(): 7 | 8 | bpy.ops.mesh.primitive_uv_sphere_add(radius=1, enter_editmode=False, align='WORLD', location=(0, 0, 0), scale=(1, 1, 1)) 9 | explosion = bpy.context.object 10 | explosion.name = 'Explosion' 11 | bpy.ops.object.shade_smooth() 12 | 13 | explosiontex = bpy.data.textures.new(name='ExplosionClouds', type = 'CLOUDS') 14 | explosiontex.noise_scale = 1.0 15 | 16 | bpy.ops.object.modifier_add(type='SUBSURF') 17 | subsurf = explosion.modifiers["Subdivision"] 18 | subsurf.levels = 2 19 | subsurf.render_levels = 2 20 | 21 | bpy.ops.object.modifier_add(type='DISPLACE') 22 | displace0 = explosion.modifiers["Displace"] 23 | displace0.texture_coords = 'GLOBAL' 24 | displace0.texture = explosiontex 25 | 26 | bpy.ops.object.modifier_add(type='DISPLACE') 27 | displace1 = explosion.modifiers["Displace.001"] 28 | 29 | bpy.ops.object.modifier_add(type='SUBSURF') 30 | subsurf1 = explosion.modifiers["Subdivision.001"] 31 | subsurf1.levels = 2 32 | subsurf1.render_levels = 2 33 | 34 | explosionmat = bpy.data.materials.new(name='explosionMaterial') 35 | explosionmat.use_nodes = True 36 | explosionmat.blend_method = 'BLEND' 37 | explosionmat.shadow_method = 'NONE' 38 | explosionmat.show_transparent_back = False 39 | explosionmat.node_tree.nodes.clear() 40 | 41 | nodes = explosionmat.node_tree.nodes 42 | 43 | output = nodes.new(type='ShaderNodeOutputMaterial') 44 | 45 | mixshader = nodes.new(type='ShaderNodeMixShader') 46 | 47 | transparent = nodes.new(type='ShaderNodeBsdfTransparent') 48 | 49 | emission = nodes.new(type='ShaderNodeEmission') 50 | emission.inputs[1].default_value = 10 51 | 52 | colorramp0 = nodes.new(type='ShaderNodeValToRGB') 53 | colorramp0.color_ramp.interpolation = 'CONSTANT' 54 | colorramp0.color_ramp.elements.new(0.5) 55 | colorramp0.color_ramp.elements.new(0.25) 56 | colorramp0.color_ramp.elements.new(0.125) 57 | colorramp0.color_ramp.elements[0].position = 0.0 58 | colorramp0.color_ramp.elements[1].position = 0.034 59 | colorramp0.color_ramp.elements[2].position = 0.056 60 | colorramp0.color_ramp.elements[3].position = 0.114 61 | colorramp0.color_ramp.elements[4].position = 0.5 62 | colorramp0.color_ramp.elements[0].color = [1.000000, 1.000000, 1.000000, 1.000000] 63 | colorramp0.color_ramp.elements[1].color = [1.000000, 0.990743, 0.000000, 1.000000] 64 | colorramp0.color_ramp.elements[2].color = [1.000000, 0.250716, 0.000000, 1.000000] 65 | colorramp0.color_ramp.elements[3].color = [0.119114, 0.119114, 0.119114, 1.000000] 66 | colorramp0.color_ramp.elements[4].color = [0.024727, 0.024727, 0.024727, 1.000000] 67 | 68 | colorramp1 = nodes.new(type='ShaderNodeValToRGB') 69 | colorramp1.color_ramp.interpolation = 'CONSTANT' 70 | colorramp1.color_ramp.elements[0].color = [0.0, 0.0, 0.0, 1.0] 71 | colorramp1.color_ramp.elements[1].color = [1.0, 1.0, 1.0, 1.0] 72 | colorramp1.color_ramp.elements[1].position = 1.0 73 | 74 | voronoi = nodes.new(type='ShaderNodeTexVoronoi') 75 | voronoi.voronoi_dimensions = '2D' 76 | 77 | fresnel = nodes.new(type='ShaderNodeFresnel') 78 | 79 | links = explosionmat.node_tree.links 80 | 81 | links.new(mixshader.outputs[0], output.inputs[0]) 82 | 83 | links.new(transparent.outputs[0], mixshader.inputs[2]) 84 | 85 | links.new(emission.outputs[0], mixshader.inputs[1]) 86 | links.new(colorramp0.outputs[0], emission.inputs[0]) 87 | links.new(fresnel.outputs[0], colorramp0.inputs[0]) 88 | 89 | 90 | links.new(colorramp1.outputs[0], mixshader.inputs[0]) 91 | links.new(voronoi.outputs[0], colorramp1.inputs[0]) 92 | links.new(fresnel.outputs[0], voronoi.inputs[0]) 93 | 94 | bpy.context.object.data.materials.append(explosionmat) 95 | 96 | 97 | class OBJECT_OT_generateExplosion(bpy.types.Operator): 98 | """Create a stylized explosion""" 99 | bl_idname = "mesh.generate_explosion" 100 | bl_label = "Add Stylized Explosion" 101 | bl_options = {'REGISTER', 'UNDO'} 102 | 103 | def execute(self, context): 104 | 105 | generateExplosion() 106 | #assignDrivers() 107 | 108 | return {'FINISHED'} 109 | -------------------------------------------------------------------------------- /Objects/FirePlane.py: -------------------------------------------------------------------------------- 1 | # fire Plane 2 | import bpy 3 | 4 | def generateFirePlane(): 5 | 6 | bpy.ops.mesh.primitive_plane_add(size=2, enter_editmode=False, align='WORLD', location=(0, 0, 0), scale=(1, 1, 1)) 7 | fireplane = bpy.context.object 8 | fireplane.name = 'fire' 9 | fireplane.rotation_euler[1] = 1.5708 10 | bpy.ops.object.shade_smooth() 11 | 12 | firemat = bpy.data.materials.new(name='fireMaterial') 13 | firemat.use_nodes = True 14 | firemat.node_tree.nodes.clear() 15 | firemat.blend_method = 'BLEND' 16 | firemat.shadow_method = 'NONE' 17 | 18 | nodes = firemat.node_tree.nodes 19 | 20 | output = nodes.new(type='ShaderNodeOutputMaterial') 21 | 22 | mixshader = nodes.new(type='ShaderNodeMixShader') 23 | 24 | emission = nodes.new(type='ShaderNodeEmission') 25 | emission.inputs[1].default_value = 20 26 | transparent = nodes.new(type='ShaderNodeBsdfTransparent') 27 | 28 | colorramp0 = nodes.new(type='ShaderNodeValToRGB') 29 | colorramp0.color_ramp.interpolation = 'CONSTANT' 30 | colorramp0.color_ramp.elements[0].position = 0.0 31 | colorramp0.color_ramp.elements[1].position = 0.032 32 | colorramp0.color_ramp.elements[0].color = (1, 1, 1, 1) 33 | colorramp0.color_ramp.elements[1].color = (0, 0, 0, 1.000000) 34 | 35 | linearlight = nodes.new(type='ShaderNodeMixRGB') 36 | linearlight.blend_type = 'LINEAR_LIGHT' 37 | linearlight.inputs[2].default_value = (0, 0, 0, 1) 38 | 39 | softlight0 = nodes.new(type='ShaderNodeMixRGB') 40 | softlight0.blend_type = 'SOFT_LIGHT' 41 | softlight0.inputs[0].default_value = 1 42 | 43 | softlight1 = nodes.new(type='ShaderNodeMixRGB') 44 | softlight1.blend_type = 'SOFT_LIGHT' 45 | softlight1.inputs[0].default_value = 1 46 | 47 | softlight2 = nodes.new(type='ShaderNodeMixRGB') 48 | softlight2.blend_type = 'SOFT_LIGHT' 49 | softlight2.inputs[0].default_value = 1 50 | 51 | voronoi0 = nodes.new(type='ShaderNodeTexVoronoi') 52 | voronoi0.inputs[2].default_value = 8 53 | 54 | voronoi1 = nodes.new(type='ShaderNodeTexVoronoi') 55 | voronoi1.inputs[2].default_value = 16 56 | 57 | voronoi2 = nodes.new(type='ShaderNodeTexVoronoi') 58 | 59 | mapping0 = nodes.new(type='ShaderNodeMapping') 60 | mapping0.inputs[3].default_value = (0.5, 1, 1) 61 | 62 | mapping1 = nodes.new(type='ShaderNodeMapping') 63 | 64 | combinexyz = nodes.new(type='ShaderNodeCombineXYZ') 65 | 66 | separatexyz = nodes.new(type='ShaderNodeSeparateXYZ') 67 | 68 | add = nodes.new(type='ShaderNodeMath') 69 | 70 | mix = nodes.new(type='ShaderNodeMixRGB') 71 | mix.inputs[2].default_value = (1, 1, 1, 1) 72 | 73 | screen = nodes.new(type='ShaderNodeMixRGB') 74 | screen.blend_type = 'SCREEN' 75 | 76 | wave = nodes.new(type='ShaderNodeTexWave') 77 | wave.inputs[1].default_value = 0.3 78 | 79 | gradient1 = nodes.new(type='ShaderNodeTexGradient') 80 | 81 | colorramp1 = nodes.new(type='ShaderNodeValToRGB') 82 | colorramp1.color_ramp.elements.new(0.5) 83 | colorramp1.color_ramp.elements[0].position = 0 84 | colorramp1.color_ramp.elements[1].position = 0.5 85 | colorramp1.color_ramp.elements[2].position = 1 86 | colorramp1.color_ramp.elements[0].color = [0.166536, 0.000000, 0.000000, 1.000000] 87 | colorramp1.color_ramp.elements[1].color = [0.354082, 0.078236, 0.000000, 1.000000] 88 | colorramp1.color_ramp.elements[2].color = [0.708214, 0.718336, 0.000000, 1.000000] 89 | 90 | invert = nodes.new(type='ShaderNodeInvert') 91 | 92 | gradient0 = nodes.new(type='ShaderNodeTexGradient') 93 | gradient0.gradient_type = 'SPHERICAL' 94 | 95 | mapping2 = nodes.new(type='ShaderNodeMapping') 96 | 97 | mapping3 = nodes.new(type='ShaderNodeMapping') 98 | mapping3.inputs[1].default_value = (0.5, 0, 0) 99 | 100 | texcoord = nodes.new(type='ShaderNodeTexCoord') 101 | 102 | links = firemat.node_tree.links 103 | 104 | links.new(mixshader.outputs[0], output.inputs[0]) 105 | 106 | links.new(colorramp0.outputs[0], mixshader.inputs[0]) 107 | links.new(emission.outputs[0], mixshader.inputs[1]) 108 | links.new(transparent.outputs[0], mixshader.inputs[2]) 109 | 110 | links.new(colorramp1.outputs[0], emission.inputs[0]) 111 | 112 | links.new(linearlight.outputs[0], colorramp0.inputs[0]) 113 | 114 | links.new(softlight0.outputs[0], linearlight.inputs[1]) 115 | links.new(softlight1.outputs[0], softlight0.inputs[2]) 116 | links.new(softlight2.outputs[0], softlight1.inputs[2]) 117 | links.new(softlight2.outputs[0], colorramp1.inputs[0]) 118 | 119 | links.new(voronoi0.outputs[0], softlight0.inputs[1]) 120 | links.new(voronoi1.outputs[0], softlight1.inputs[1]) 121 | links.new(voronoi2.outputs[0], softlight2.inputs[1]) 122 | 123 | links.new(mapping0.outputs[0], voronoi0.inputs[0]) 124 | links.new(mapping0.outputs[0], voronoi1.inputs[0]) 125 | links.new(mapping0.outputs[0], voronoi2.inputs[0]) 126 | 127 | links.new(combinexyz.outputs[0], mapping0.inputs[0]) 128 | 129 | links.new(separatexyz.outputs[0], combinexyz.inputs[0]) 130 | links.new(separatexyz.outputs[1], add.inputs[0]) 131 | links.new(add.outputs[0], combinexyz.inputs[1]) 132 | links.new(separatexyz.outputs[2], combinexyz.inputs[2]) 133 | 134 | links.new(mix.outputs[0], add.inputs[1]) 135 | links.new(screen.outputs[0], mix.inputs[1]) 136 | links.new(wave.outputs[0], screen.inputs[1]) 137 | links.new(mapping1.outputs[0], wave.inputs[0]) 138 | 139 | links.new(gradient1.outputs[0], screen.inputs[2]) 140 | links.new(mapping3.outputs[0], gradient1.inputs[0]) 141 | 142 | links.new(texcoord.outputs[0], mapping1.inputs[0]) 143 | links.new(texcoord.outputs[3], mapping2.inputs[0]) 144 | links.new(texcoord.outputs[0], mapping3.inputs[0]) 145 | links.new(texcoord.outputs[0], separatexyz.inputs[0]) 146 | 147 | links.new(invert.outputs[0], linearlight.inputs[0]) 148 | links.new(gradient0.outputs[0], invert.inputs[1]) 149 | links.new(gradient0.outputs[0], softlight2.inputs[2]) 150 | 151 | links.new(mapping2.outputs[0], gradient0.inputs[0]) 152 | 153 | bpy.context.object.data.materials.append(firemat) 154 | 155 | 156 | class OBJECT_OT_generateFirePlane(bpy.types.Operator): 157 | """Create a stylized fire plane""" 158 | bl_idname = "mesh.generate_fire_plane" 159 | bl_label = "Add Stylized fire" 160 | bl_options = {'REGISTER', 'UNDO'} 161 | 162 | def execute(self, context): 163 | 164 | generateFirePlane() 165 | 166 | return {'FINISHED'} 167 | -------------------------------------------------------------------------------- /Objects/HeatRipplePlane.py: -------------------------------------------------------------------------------- 1 | # heatripple Plane 2 | import bpy 3 | 4 | def generateHeatRipplePlane(): 5 | 6 | bpy.context.scene.eevee.use_ssr = True 7 | bpy.context.scene.eevee.use_ssr_refraction = True 8 | 9 | bpy.ops.mesh.primitive_plane_add(size=2, enter_editmode=False, align='WORLD', location=(0, 0, 0), scale=(1, 1, 1)) 10 | heatrippleplane = bpy.context.object 11 | heatrippleplane.name = 'HeatRipple' 12 | heatrippleplane.rotation_euler[1] = 1.5708 13 | bpy.ops.object.shade_smooth() 14 | 15 | heatripplemat = bpy.data.materials.new(name='heatrippleMaterial') 16 | heatripplemat.use_nodes = True 17 | heatripplemat.node_tree.nodes.clear() 18 | heatripplemat.blend_method = 'BLEND' 19 | heatripplemat.shadow_method = 'NONE' 20 | heatripplemat.use_screen_refraction = True 21 | 22 | nodes = heatripplemat.node_tree.nodes 23 | 24 | output = nodes.new(type='ShaderNodeOutputMaterial') 25 | 26 | mixshader = nodes.new(type='ShaderNodeMixShader') 27 | 28 | refraction = nodes.new(type='ShaderNodeBsdfRefraction') 29 | transparent = nodes.new(type='ShaderNodeBsdfTransparent') 30 | 31 | bump = nodes.new(type='ShaderNodeBump') 32 | 33 | noise1 = nodes.new(type='ShaderNodeTexNoise') 34 | noise1.noise_dimensions = '4D' 35 | noise1.inputs[2].default_value = 1 36 | noise1.inputs[4].default_value = 1 37 | 38 | invert = nodes.new(type='ShaderNodeInvert') 39 | 40 | gradient = nodes.new(type='ShaderNodeTexGradient') 41 | gradient.gradient_type = 'SPHERICAL' 42 | 43 | mapping1 = nodes.new(type='ShaderNodeMapping') 44 | 45 | texcoord = nodes.new(type='ShaderNodeTexCoord') 46 | 47 | links = heatripplemat.node_tree.links 48 | 49 | links.new(mixshader.outputs[0], output.inputs[0]) 50 | 51 | links.new(invert.outputs[0], mixshader.inputs[0]) 52 | 53 | links.new(refraction.outputs[0], mixshader.inputs[1]) 54 | 55 | links.new(transparent.outputs[0], mixshader.inputs[2]) 56 | 57 | links.new(gradient.outputs[0], invert.inputs[1]) 58 | 59 | links.new(mapping1.outputs[0], gradient.inputs[0]) 60 | 61 | links.new(noise1.outputs[1], bump.inputs[2]) 62 | 63 | links.new(bump.outputs[0], refraction.inputs[3]) 64 | 65 | links.new(mapping1.outputs[0], noise1.inputs[0]) 66 | 67 | links.new(texcoord.outputs[3], mapping1.inputs[0]) 68 | 69 | bpy.context.object.data.materials.append(heatripplemat) 70 | 71 | 72 | class OBJECT_OT_generateHeatRipplePlane(bpy.types.Operator): 73 | """Create a stylized heat distortion effect plane""" 74 | bl_idname = "mesh.generate_heatripple_plane" 75 | bl_label = "Add Stylized heat distortion effect" 76 | bl_options = {'REGISTER', 'UNDO'} 77 | 78 | def execute(self, context): 79 | 80 | generateHeatRipplePlane() 81 | 82 | return {'FINISHED'} 83 | -------------------------------------------------------------------------------- /Objects/LightBeamPlane.py: -------------------------------------------------------------------------------- 1 | # lightbeam Plane 2 | import bpy 3 | 4 | def generateLightBeamPlane(): 5 | 6 | bpy.ops.mesh.primitive_plane_add(size=2, enter_editmode=False, align='WORLD', location=(0, 0, 0), scale=(1, 1, 1)) 7 | lightbeamplane = bpy.context.object 8 | lightbeamplane.name = 'lightbeam' 9 | lightbeamplane.rotation_euler[1] = 1.5708 10 | bpy.ops.object.shade_smooth() 11 | 12 | lightbeammat = bpy.data.materials.new(name='lightbeamMaterial') 13 | lightbeammat.use_nodes = True 14 | lightbeammat.node_tree.nodes.clear() 15 | lightbeammat.blend_method = 'BLEND' 16 | lightbeammat.shadow_method = 'NONE' 17 | 18 | nodes = lightbeammat.node_tree.nodes 19 | 20 | output = nodes.new(type='ShaderNodeOutputMaterial') 21 | 22 | mixshader0 = nodes.new(type='ShaderNodeMixShader') 23 | mixshader0.inputs[0].default_value = 0.9 24 | mixshader1 = nodes.new(type='ShaderNodeMixShader') 25 | 26 | emission = nodes.new(type='ShaderNodeEmission') 27 | emission.inputs[1].default_value = 20 28 | transparent0 = nodes.new(type='ShaderNodeBsdfTransparent') 29 | transparent1 = nodes.new(type='ShaderNodeBsdfTransparent') 30 | 31 | colorramp = nodes.new(type='ShaderNodeValToRGB') 32 | colorramp.color_ramp.interpolation = 'EASE' 33 | colorramp.color_ramp.elements[0].color = [1.000000, 0.002548, 0.000000, 1.000000] 34 | colorramp.color_ramp.elements[1].color = [1.000000, 0.708078, 0.000000, 1.000000] 35 | 36 | invert = nodes.new(type='ShaderNodeInvert') 37 | 38 | gradient = nodes.new(type='ShaderNodeTexGradient') 39 | gradient.gradient_type = 'SPHERICAL' 40 | 41 | mapping1 = nodes.new(type='ShaderNodeMapping') 42 | 43 | texcoord = nodes.new(type='ShaderNodeTexCoord') 44 | 45 | links = lightbeammat.node_tree.links 46 | 47 | links.new(mixshader0.outputs[0], output.inputs[0]) 48 | 49 | links.new(mixshader1.outputs[0], mixshader0.inputs[1]) 50 | 51 | links.new(transparent0.outputs[0], mixshader0.inputs[2]) 52 | 53 | links.new(transparent1.outputs[0], mixshader1.inputs[2]) 54 | 55 | links.new(emission.outputs[0], mixshader1.inputs[1]) 56 | 57 | links.new(colorramp.outputs[0], emission.inputs[0]) 58 | 59 | links.new(gradient.outputs[0], colorramp.inputs[0]) 60 | 61 | links.new(gradient.outputs[0], invert.inputs[1]) 62 | 63 | links.new(invert.outputs[0], mixshader1.inputs[0]) 64 | 65 | links.new(mapping1.outputs[0], gradient.inputs[0]) 66 | 67 | links.new(texcoord.outputs[3], mapping1.inputs[0]) 68 | 69 | bpy.context.object.data.materials.append(lightbeammat) 70 | 71 | 72 | class OBJECT_OT_generateLightBeamPlane(bpy.types.Operator): 73 | """Create a stylized beam of light""" 74 | bl_idname = "mesh.generate_lightbeam_plane" 75 | bl_label = "Add Stylized light beam" 76 | bl_options = {'REGISTER', 'UNDO'} 77 | 78 | def execute(self, context): 79 | 80 | generateLightBeamPlane() 81 | 82 | return {'FINISHED'} 83 | -------------------------------------------------------------------------------- /Objects/LightSpotPlane.py: -------------------------------------------------------------------------------- 1 | # lightspot Plane 2 | import bpy 3 | 4 | def generateLightSpotPlane(): 5 | 6 | bpy.ops.mesh.primitive_plane_add(size=2, enter_editmode=False, align='WORLD', location=(0, 0, 0), scale=(1, 1, 1)) 7 | lightspotplane = bpy.context.object 8 | lightspotplane.name = 'lightspot' 9 | lightspotplane.rotation_euler[1] = 1.5708 10 | bpy.ops.object.shade_smooth() 11 | 12 | lightspotmat = bpy.data.materials.new(name='lightspotMaterial') 13 | lightspotmat.use_nodes = True 14 | lightspotmat.node_tree.nodes.clear() 15 | lightspotmat.blend_method = 'BLEND' 16 | lightspotmat.shadow_method = 'NONE' 17 | 18 | nodes = lightspotmat.node_tree.nodes 19 | 20 | output = nodes.new(type='ShaderNodeOutputMaterial') 21 | 22 | mixshader0 = nodes.new(type='ShaderNodeMixShader') 23 | mixshader0.inputs[0].default_value = 0.9 24 | mixshader1 = nodes.new(type='ShaderNodeMixShader') 25 | 26 | emission = nodes.new(type='ShaderNodeEmission') 27 | emission.inputs[1].default_value = 20 28 | transparent0 = nodes.new(type='ShaderNodeBsdfTransparent') 29 | transparent1 = nodes.new(type='ShaderNodeBsdfTransparent') 30 | 31 | colorramp = nodes.new(type='ShaderNodeValToRGB') 32 | colorramp.color_ramp.interpolation = 'EASE' 33 | colorramp.color_ramp.elements[0].color = [1.000000, 0.002548, 0.000000, 1.000000] 34 | colorramp.color_ramp.elements[1].color = [1.000000, 0.708078, 0.000000, 1.000000] 35 | 36 | invert = nodes.new(type='ShaderNodeInvert') 37 | 38 | gradient = nodes.new(type='ShaderNodeTexGradient') 39 | gradient.gradient_type = 'SPHERICAL' 40 | 41 | mapping1 = nodes.new(type='ShaderNodeMapping') 42 | 43 | texcoord = nodes.new(type='ShaderNodeTexCoord') 44 | 45 | links = lightspotmat.node_tree.links 46 | 47 | links.new(mixshader0.outputs[0], output.inputs[0]) 48 | 49 | links.new(mixshader1.outputs[0], mixshader0.inputs[1]) 50 | 51 | links.new(transparent0.outputs[0], mixshader0.inputs[2]) 52 | 53 | links.new(transparent1.outputs[0], mixshader1.inputs[2]) 54 | 55 | links.new(emission.outputs[0], mixshader1.inputs[1]) 56 | 57 | links.new(colorramp.outputs[0], emission.inputs[0]) 58 | 59 | links.new(gradient.outputs[0], colorramp.inputs[0]) 60 | 61 | links.new(gradient.outputs[0], invert.inputs[1]) 62 | 63 | links.new(invert.outputs[0], mixshader1.inputs[0]) 64 | 65 | links.new(mapping1.outputs[0], gradient.inputs[0]) 66 | 67 | links.new(texcoord.outputs[3], mapping1.inputs[0]) 68 | 69 | bpy.context.object.data.materials.append(lightspotmat) 70 | 71 | 72 | class OBJECT_OT_generateLightSpotPlane(bpy.types.Operator): 73 | """Create a stylized circle of light""" 74 | bl_idname = "mesh.generate_lightspot_plane" 75 | bl_label = "Add Stylized light circle" 76 | bl_options = {'REGISTER', 'UNDO'} 77 | 78 | def execute(self, context): 79 | 80 | generateLightSpotPlane() 81 | 82 | return {'FINISHED'} 83 | -------------------------------------------------------------------------------- /Objects/RainPlane.py: -------------------------------------------------------------------------------- 1 | # Rain Plane 2 | import bpy 3 | 4 | def generateRainPlane(): 5 | 6 | bpy.ops.mesh.primitive_plane_add(size=2, enter_editmode=False, align='WORLD', location=(0, 0, 0), scale=(1, 1, 1)) 7 | rainplane = bpy.context.object 8 | rainplane.name = 'Rain' 9 | rainplane.rotation_euler[1] = 1.5708 10 | bpy.ops.object.shade_smooth() 11 | 12 | rainmat = bpy.data.materials.new(name='RainMaterial') 13 | rainmat.use_nodes = True 14 | rainmat.node_tree.nodes.clear() 15 | rainmat.blend_method = 'BLEND' 16 | 17 | nodes = rainmat.node_tree.nodes 18 | 19 | output = nodes.new(type='ShaderNodeOutputMaterial') 20 | 21 | mixshader = nodes.new(type='ShaderNodeMixShader') 22 | 23 | emission = nodes.new(type='ShaderNodeEmission') 24 | transparent = nodes.new(type='ShaderNodeBsdfTransparent') 25 | mixrgb = nodes.new(type='ShaderNodeMixRGB') 26 | 27 | colorramp1 = nodes.new(type='ShaderNodeValToRGB') 28 | colorramp1.color_ramp.elements[0].position = 0.6 29 | colorramp1.color_ramp.elements[1].position = 1 30 | colorramp1.color_ramp.elements[0].color = (1, 1, 1, 1) 31 | colorramp1.color_ramp.elements[1].color = (0, 0, 0, 1.000000) 32 | colorramp2 = nodes.new(type='ShaderNodeValToRGB') 33 | colorramp2.color_ramp.elements[0].position = 0.6 34 | colorramp2.color_ramp.elements[1].position = 1 35 | colorramp2.color_ramp.elements[0].color = (1, 1, 1, 1) 36 | colorramp2.color_ramp.elements[1].color = (0, 0, 0, 1) 37 | 38 | noise1 = nodes.new(type='ShaderNodeTexNoise') 39 | noise1.inputs[2].default_value = 10 40 | 41 | noise2 = nodes.new(type='ShaderNodeTexNoise') 42 | noise2.inputs[2].default_value = 15 43 | 44 | mapping1 = nodes.new(type='ShaderNodeMapping') 45 | mapping1.inputs[3].default_value = (0.5, 10, 1) 46 | 47 | mapping2 = nodes.new(type='ShaderNodeMapping') 48 | mapping2.inputs[3].default_value = (0.8, 15, 1) 49 | 50 | texcoord = nodes.new(type='ShaderNodeTexCoord') 51 | 52 | links = rainmat.node_tree.links 53 | 54 | links.new(mixshader.outputs[0], output.inputs[0]) 55 | 56 | links.new(mixrgb.outputs[0], mixshader.inputs[0]) 57 | 58 | links.new(emission.outputs[0], mixshader.inputs[1]) 59 | 60 | links.new(transparent.outputs[0], mixshader.inputs[2]) 61 | 62 | links.new(colorramp1.outputs[0], mixrgb.inputs[1]) 63 | 64 | links.new(colorramp2.outputs[0], mixrgb.inputs[2]) 65 | 66 | links.new(noise1.outputs[1], colorramp1.inputs[0]) 67 | 68 | links.new(noise2.outputs[1], colorramp2.inputs[0]) 69 | 70 | links.new(mapping1.outputs[0], noise1.inputs[0]) 71 | 72 | links.new(mapping2.outputs[0], noise2.inputs[0]) 73 | 74 | links.new(texcoord.outputs[0], mapping1.inputs[0]) 75 | links.new(texcoord.outputs[0], mapping2.inputs[0]) 76 | 77 | bpy.context.object.data.materials.append(rainmat) 78 | 79 | 80 | class OBJECT_OT_generateRainPlane(bpy.types.Operator): 81 | """Create a stylized rain plane""" 82 | bl_idname = "mesh.generate_rain_plane" 83 | bl_label = "Add Stylized Rain" 84 | bl_options = {'REGISTER', 'UNDO'} 85 | 86 | def execute(self, context): 87 | 88 | generateRainPlane() 89 | 90 | return {'FINISHED'} 91 | -------------------------------------------------------------------------------- /Objects/Rock.py: -------------------------------------------------------------------------------- 1 | # Rock Generator 2 | import bpy 3 | 4 | from .Drivers.RockDrivers import * 5 | 6 | def generateRock(): 7 | 8 | bpy.ops.mesh.primitive_uv_sphere_add(radius=1, enter_editmode=False, align='WORLD', location=(0, 0, 0), scale=(1, 1, 1)) 9 | rock = bpy.context.object 10 | rock.scale[2] = 0.75 11 | rock.name = 'Rock' 12 | bpy.ops.object.shade_smooth() 13 | 14 | rocktex = bpy.data.textures.new(name='Clouds', type = 'CLOUDS') 15 | rocktex.noise_scale = 0.5 16 | 17 | bpy.ops.object.modifier_add(type='DISPLACE') 18 | displace = rock.modifiers["Displace"] 19 | displace.texture_coords = 'GLOBAL' 20 | displace.strength = 0.5 21 | displace.texture = rocktex 22 | 23 | rockmat = bpy.data.materials.new(name='RockMaterial') 24 | rockmat.use_nodes = True 25 | rockmat.node_tree.nodes.clear() 26 | 27 | nodes = rockmat.node_tree.nodes 28 | 29 | output = nodes.new(type='ShaderNodeOutputMaterial') 30 | 31 | # Translucent & Normal Node 32 | translucent = nodes.new(type='ShaderNodeBsdfTranslucent') 33 | normal = nodes.new(type='ShaderNodeNormal') 34 | normal.outputs[0].default_value = (0, 0, -1) 35 | # Ends 36 | 37 | mixrgb1 = nodes.new(type='ShaderNodeMixRGB') 38 | mixrgb1.inputs[2].default_value = (0.1, 0.2, 0.3, 1) 39 | 40 | # colorramp1 = nodes.new(type='ShaderNodeValToRGB') 41 | # colorramp1.color_ramp.elements[0].position = 0.25 42 | # colorramp1.color_ramp.elements[1].position = 0.8 43 | brightcontrast = nodes.new(type='ShaderNodeBrightContrast') 44 | brightcontrast.inputs[1].default_value = -0.1 45 | brightcontrast.inputs[2].default_value = 1.0 46 | multiply = nodes.new(type='ShaderNodeMixRGB') 47 | multiply.inputs[0].default_value = 0.9 48 | multiply.blend_type = 'MULTIPLY' 49 | 50 | colorramp2 = nodes.new(type='ShaderNodeValToRGB') 51 | colorramp2.color_ramp.elements[0].color = (0.015712, 0.031914, 0.038389, 1.000000) 52 | colorramp2.color_ramp.elements[1].color = (0.046440, 0.105856, 0.149684, 1.000000) 53 | colorramp3 = nodes.new(type='ShaderNodeValToRGB') 54 | colorramp3.color_ramp.elements[0].color = (0.005042, 0.021007, 0.044304, 1.000000) 55 | colorramp3.color_ramp.elements[1].color = (0.030861, 0.057856, 0.127087, 1.000000) 56 | 57 | mixrgb2 = nodes.new(type='ShaderNodeMixRGB') 58 | 59 | softlight = nodes.new(type='ShaderNodeMixRGB') 60 | softlight.inputs[0].default_value = 0.3 61 | softlight.blend_type = 'SOFT_LIGHT' 62 | gradient = nodes.new(type='ShaderNodeTexGradient') 63 | 64 | voronoi1 = nodes.new(type='ShaderNodeTexVoronoi') 65 | voronoi1.feature = 'SMOOTH_F1' 66 | voronoi1.inputs[1].default_value = 3 67 | voronoi2 = nodes.new(type='ShaderNodeTexVoronoi') 68 | voronoi2.feature = 'SMOOTH_F1' 69 | voronoi2.inputs[1].default_value = 24 70 | voronoi2.inputs[3].default_value = 1 71 | mapping1 = nodes.new(type='ShaderNodeMapping') 72 | mapping1.inputs[2].default_value = (0, 1.5708, 0) 73 | 74 | mapping2 = nodes.new(type='ShaderNodeMapping') 75 | colorramp4 = nodes.new(type='ShaderNodeValToRGB') 76 | colorramp4.color_ramp.elements[0].position = 0.3 77 | colorramp4.color_ramp.elements[1].position = 0.6 78 | texcoord1 = nodes.new(type='ShaderNodeTexCoord') 79 | 80 | texcoord2 = nodes.new(type='ShaderNodeTexCoord') 81 | objectinfo = nodes.new(type='ShaderNodeObjectInfo') 82 | mixrgb3 = nodes.new(type='ShaderNodeMixRGB') 83 | mixrgb3.inputs[0].default_value = 0.9 84 | mixrgb3.inputs[2].default_value = (1, 1, 1, 1) 85 | noise1 = nodes.new(type='ShaderNodeTexNoise') 86 | noise1.inputs[2].default_value = 100 87 | noise1.inputs[3].default_value = 15 88 | 89 | noise2 = nodes.new(type='ShaderNodeTexNoise') 90 | noise2.inputs[2].default_value = 30 91 | noise2.inputs[3].default_value = 0.01 92 | 93 | links = rockmat.node_tree.links 94 | 95 | links.new(translucent.outputs[0], output.inputs[0]) 96 | 97 | links.new(mixrgb1.outputs[0], translucent.inputs[0]) 98 | links.new(normal.outputs[0], translucent.inputs[1]) 99 | 100 | links.new(brightcontrast.outputs[0], mixrgb1.inputs[0]) 101 | links.new(multiply.outputs[0], mixrgb1.inputs[1]) 102 | 103 | links.new(mixrgb2.outputs[0], brightcontrast.inputs[0]) 104 | 105 | links.new(colorramp2.outputs[0], multiply.inputs[1]) 106 | links.new(colorramp3.outputs[0], multiply.inputs[2]) 107 | 108 | links.new(softlight.outputs[0], colorramp2.inputs[0]) 109 | 110 | links.new(mixrgb2.outputs[0], colorramp3.inputs[0]) 111 | 112 | links.new(softlight.outputs[0], mixrgb2.inputs[1]) 113 | 114 | links.new(gradient.outputs[0], mixrgb2.inputs[2]) 115 | 116 | links.new(voronoi1.outputs[1], softlight.inputs[1]) 117 | 118 | links.new(voronoi2.outputs[1], softlight.inputs[2]) 119 | 120 | links.new(mapping1.outputs[0], gradient.inputs[0]) 121 | 122 | links.new(mapping2.outputs[0], voronoi1.inputs[0]) 123 | links.new(mapping2.outputs[0], voronoi2.inputs[0]) 124 | 125 | links.new(colorramp4.outputs[0], voronoi1.inputs[3]) 126 | links.new(colorramp4.outputs[0], voronoi2.inputs[3]) 127 | 128 | links.new(texcoord1.outputs[0], mapping1.inputs[0]) 129 | 130 | links.new(texcoord2.outputs[0], mapping2.inputs[0]) 131 | 132 | links.new(objectinfo.outputs[0], mapping2.inputs[1]) 133 | 134 | links.new(mixrgb3.outputs[0], mapping2.inputs[3]) 135 | 136 | links.new(noise1.outputs[1], colorramp4.inputs[0]) 137 | 138 | links.new(noise2.outputs[1], mixrgb3.inputs[1]) 139 | 140 | bpy.context.object.data.materials.append(rockmat) 141 | 142 | 143 | class OBJECT_OT_generateRock(bpy.types.Operator): 144 | """Create a stylized rock""" 145 | bl_idname = "mesh.generate_rock" 146 | bl_label = "Add Stylized Rock" 147 | bl_options = {'REGISTER', 'UNDO'} 148 | 149 | def execute(self, context): 150 | 151 | generateRock() 152 | assignDrivers() 153 | 154 | return {'FINISHED'} 155 | -------------------------------------------------------------------------------- /Objects/SceneryConveyor.py: -------------------------------------------------------------------------------- 1 | # Scenery Conveyor 2 | 3 | import bpy 4 | 5 | # Creating the Curve 6 | 7 | bpy.ops.curve.primitive_bezier_curve_add(radius=1) 8 | 9 | converyorcurve = bpy.context.object 10 | converyorcurve.name = 'ConveyorCurve' 11 | 12 | bpy.ops.transform.rotate(value=1.5708) 13 | 14 | bpy.ops.object.editmode_toggle() 15 | 16 | bpy.ops.curve.select_all(action='DESELECT') 17 | 18 | bpy.ops.curve.de_select_first() 19 | 20 | bpy.ops.transform.rotate(value=0.785398, orient_axis='Z') 21 | 22 | bpy.ops.curve.select_all(action='SELECT') 23 | 24 | bpy.ops.curve.duplicate_move(CURVE_OT_duplicate={}, TRANSFORM_OT_translate={"value":(0, 0, 1)}) 25 | 26 | bpy.ops.curve.select_all(action='DESELECT') 27 | 28 | bpy.ops.curve.de_select_first() 29 | 30 | bpy.ops.curve.make_segment() 31 | 32 | bpy.ops.curve.select_all(action='DESELECT') 33 | 34 | bpy.ops.curve.de_select_first() 35 | 36 | bpy.ops.curve.de_select_last() 37 | 38 | bpy.ops.curve.make_segment() 39 | 40 | bpy.ops.object.editmode_toggle() 41 | 42 | bpy.ops.transform.resize(value=(-10, -100, -10)) 43 | 44 | bpy.ops.object.transform_apply(location=True, rotation=True, scale=True) 45 | 46 | # Creating the Plane 47 | bpy.ops.mesh.primitive_plane_add() 48 | 49 | conveyorplane = bpy.context.object 50 | conveyorplane.name = 'ConveyorPlane' 51 | 52 | bpy.ops.transform.resize(value=(1, 0.5, 1)) 53 | 54 | bpy.ops.object.modifier_add(type='ARRAY') 55 | bpy.context.object.modifiers["Array"].fit_type = 'FIT_CURVE' 56 | bpy.context.object.modifiers["Array"].curve = bpy.data.objects["ConveyorCurve"] 57 | 58 | bpy.ops.object.modifier_add(type='CURVE') 59 | bpy.context.object.modifiers["Curve"].object = bpy.data.objects["ConveyorCurve"] 60 | 61 | bpy.ops.object.particle_system_add() 62 | bpy.context.object.particle_systems[0].name = 'SceneryParticles' 63 | particle = bpy.context.object.particle_systems[0].settings 64 | particle.name = 'SceneryParticleSettings' 65 | particle.type = 'HAIR' 66 | particle.count = 100 67 | #particle.hair_length = 2 68 | particle.hair_step = 2 69 | particle.render_step = 2 70 | particle.distribution = 'RAND' 71 | particle.use_modifier_stack = True 72 | 73 | # Creating the Transparent Material 74 | conveyormat = bpy.data.materials.new(name='ConveyorMaterial') 75 | conveyormat.use_nodes = True 76 | conveyormat.blend_method = 'BLEND' 77 | conveyormat.shadow_method = 'NONE' 78 | conveyormat.node_tree.nodes.clear() 79 | 80 | nodes = conveyormat.node_tree.nodes 81 | 82 | output = nodes.new(type='ShaderNodeOutputMaterial') 83 | 84 | transparent = nodes.new(type='ShaderNodeBsdfTransparent') 85 | 86 | links = conveyormat.node_tree.links 87 | 88 | links.new(transparent.outputs[0], output.inputs[0]) 89 | 90 | bpy.context.object.data.materials.append(conveyormat) 91 | 92 | -------------------------------------------------------------------------------- /Objects/SmokeCloud.py: -------------------------------------------------------------------------------- 1 | # Smoke Cloud Generator 2 | import bpy 3 | 4 | #from .Drivers.smokeDrivers import * 5 | 6 | def generateSmokeCloud(): 7 | 8 | bpy.ops.mesh.primitive_uv_sphere_add(radius=1, enter_editmode=False, align='WORLD', location=(0, 0, 0), scale=(1, 1, 1)) 9 | smoke = bpy.context.object 10 | smoke.name = 'SmokeCloud' 11 | bpy.ops.object.shade_smooth() 12 | 13 | smoketex = bpy.data.textures.new(name='Clouds', type = 'CLOUDS') 14 | smoketex.noise_scale = 1.0 15 | 16 | bpy.ops.object.modifier_add(type='SUBSURF') 17 | subsurf = smoke.modifiers["Subdivision"] 18 | subsurf.levels = 2 19 | subsurf.render_levels = 2 20 | 21 | bpy.ops.object.modifier_add(type='DISPLACE') 22 | displace0 = smoke.modifiers["Displace"] 23 | displace0.texture_coords = 'GLOBAL' 24 | displace0.texture = smoketex 25 | 26 | bpy.ops.object.modifier_add(type='SUBSURF') 27 | subsurf1 = smoke.modifiers["Subdivision.001"] 28 | subsurf1.levels = 2 29 | subsurf1.render_levels = 2 30 | 31 | bpy.ops.object.modifier_add(type='DISPLACE') 32 | displace1 = smoke.modifiers["Displace.001"] 33 | displace1.mid_level = 0.9 34 | 35 | smokemat = bpy.data.materials.new(name='smokeMaterial') 36 | smokemat.use_nodes = True 37 | smokemat.blend_method = 'BLEND' 38 | smokemat.shadow_method = 'NONE' 39 | smokemat.show_transparent_back = False 40 | smokemat.node_tree.nodes.clear() 41 | 42 | nodes = smokemat.node_tree.nodes 43 | 44 | output = nodes.new(type='ShaderNodeOutputMaterial') 45 | 46 | mixshader = nodes.new(type='ShaderNodeMixShader') 47 | 48 | transparent = nodes.new(type='ShaderNodeBsdfTransparent') 49 | 50 | colorramp0 = nodes.new(type='ShaderNodeValToRGB') 51 | colorramp0.color_ramp.interpolation = 'CONSTANT' 52 | colorramp0.color_ramp.elements.new(0.5) 53 | colorramp0.color_ramp.elements[0].color = [0.056122, 0.056122, 0.056122, 1.000000] 54 | colorramp0.color_ramp.elements[1].color = [0.104094, 0.104094, 0.104094, 1.000000] 55 | colorramp0.color_ramp.elements[2].color = [0.369217, 0.369217, 0.369217, 1.000000] 56 | colorramp0.color_ramp.elements[1].position = 0.01 57 | colorramp0.color_ramp.elements[2].position = 0.1 58 | 59 | shadertorgb = nodes.new(type='ShaderNodeShaderToRGB') 60 | 61 | diffuse = nodes.new(type='ShaderNodeBsdfDiffuse') 62 | 63 | colorramp1 = nodes.new(type='ShaderNodeValToRGB') 64 | colorramp1.color_ramp.interpolation = 'CONSTANT' 65 | colorramp1.color_ramp.elements[0].color = [0.0, 0.0, 0.0, 1.0] 66 | colorramp1.color_ramp.elements[1].color = [1.0, 1.0, 1.0, 1.0] 67 | colorramp1.color_ramp.elements[1].position = 1.0 68 | 69 | voronoi = nodes.new(type='ShaderNodeTexVoronoi') 70 | voronoi.voronoi_dimensions = '2D' 71 | 72 | fresnel = nodes.new(type='ShaderNodeFresnel') 73 | 74 | links = smokemat.node_tree.links 75 | 76 | links.new(mixshader.outputs[0], output.inputs[0]) 77 | 78 | links.new(transparent.outputs[0], mixshader.inputs[2]) 79 | 80 | links.new(colorramp0.outputs[0], mixshader.inputs[1]) 81 | links.new(shadertorgb.outputs[0], colorramp0.inputs[0]) 82 | links.new(diffuse.outputs[0], shadertorgb.inputs[0]) 83 | 84 | links.new(colorramp1.outputs[0], mixshader.inputs[0]) 85 | links.new(voronoi.outputs[0], colorramp1.inputs[0]) 86 | links.new(fresnel.outputs[0], diffuse.inputs[0]) 87 | links.new(fresnel.outputs[0], voronoi.inputs[0]) 88 | 89 | bpy.context.object.data.materials.append(smokemat) 90 | 91 | 92 | class OBJECT_OT_generateSmokeCloud(bpy.types.Operator): 93 | """Create a stylized smoke cloud""" 94 | bl_idname = "mesh.generate_smoke_cloud" 95 | bl_label = "Add Stylized Smoke Cloud" 96 | bl_options = {'REGISTER', 'UNDO'} 97 | 98 | def execute(self, context): 99 | 100 | generateSmokeCloud() 101 | #assignDrivers() 102 | 103 | return {'FINISHED'} 104 | -------------------------------------------------------------------------------- /Objects/SmokeRing.py: -------------------------------------------------------------------------------- 1 | # Smoke Ring Generator 2 | import bpy 3 | 4 | #from .Drivers.smokeDrivers import * 5 | 6 | def generateSmokeRing(): 7 | 8 | bpy.ops.mesh.primitive_torus_add(align='WORLD', location=(0, 0, 0), rotation=(0, 0, 0), major_radius=1, minor_radius=0.25, abso_major_rad=1.25, abso_minor_rad=0.75) 9 | smoke = bpy.context.object 10 | smoke.name = 'SmokeRing' 11 | bpy.ops.object.shade_smooth() 12 | 13 | smoketex = bpy.data.textures.new(name='Clouds', type = 'CLOUDS') 14 | smoketex.noise_scale = 1.0 15 | 16 | bpy.ops.object.modifier_add(type='SUBSURF') 17 | subsurf = smoke.modifiers["Subdivision"] 18 | subsurf.levels = 2 19 | subsurf.render_levels = 2 20 | 21 | bpy.ops.object.modifier_add(type='DISPLACE') 22 | displace0 = smoke.modifiers["Displace"] 23 | displace0.texture_coords = 'GLOBAL' 24 | displace0.texture = smoketex 25 | 26 | bpy.ops.object.modifier_add(type='SUBSURF') 27 | subsurf1 = smoke.modifiers["Subdivision.001"] 28 | subsurf1.levels = 2 29 | subsurf1.render_levels = 2 30 | 31 | bpy.ops.object.modifier_add(type='DISPLACE') 32 | displace1 = smoke.modifiers["Displace.001"] 33 | displace1.mid_level = 0.9 34 | 35 | smokemat = bpy.data.materials.new(name='smokeMaterial') 36 | smokemat.use_nodes = True 37 | smokemat.blend_method = 'BLEND' 38 | smokemat.shadow_method = 'NONE' 39 | smokemat.show_transparent_back = False 40 | smokemat.node_tree.nodes.clear() 41 | 42 | nodes = smokemat.node_tree.nodes 43 | 44 | output = nodes.new(type='ShaderNodeOutputMaterial') 45 | 46 | mixshader = nodes.new(type='ShaderNodeMixShader') 47 | 48 | transparent = nodes.new(type='ShaderNodeBsdfTransparent') 49 | 50 | colorramp0 = nodes.new(type='ShaderNodeValToRGB') 51 | colorramp0.color_ramp.interpolation = 'CONSTANT' 52 | colorramp0.color_ramp.elements.new(0.5) 53 | colorramp0.color_ramp.elements[0].color = [0.056122, 0.056122, 0.056122, 1.000000] 54 | colorramp0.color_ramp.elements[1].color = [0.104094, 0.104094, 0.104094, 1.000000] 55 | colorramp0.color_ramp.elements[2].color = [0.369217, 0.369217, 0.369217, 1.000000] 56 | colorramp0.color_ramp.elements[1].position = 0.01 57 | colorramp0.color_ramp.elements[2].position = 0.1 58 | 59 | shadertorgb = nodes.new(type='ShaderNodeShaderToRGB') 60 | 61 | diffuse = nodes.new(type='ShaderNodeBsdfDiffuse') 62 | 63 | colorramp1 = nodes.new(type='ShaderNodeValToRGB') 64 | colorramp1.color_ramp.interpolation = 'CONSTANT' 65 | colorramp1.color_ramp.elements[0].color = [0.0, 0.0, 0.0, 1.0] 66 | colorramp1.color_ramp.elements[1].color = [1.0, 1.0, 1.0, 1.0] 67 | colorramp1.color_ramp.elements[1].position = 1.0 68 | 69 | voronoi = nodes.new(type='ShaderNodeTexVoronoi') 70 | voronoi.voronoi_dimensions = '2D' 71 | 72 | fresnel = nodes.new(type='ShaderNodeFresnel') 73 | 74 | links = smokemat.node_tree.links 75 | 76 | links.new(mixshader.outputs[0], output.inputs[0]) 77 | 78 | links.new(transparent.outputs[0], mixshader.inputs[2]) 79 | 80 | links.new(colorramp0.outputs[0], mixshader.inputs[1]) 81 | links.new(shadertorgb.outputs[0], colorramp0.inputs[0]) 82 | links.new(diffuse.outputs[0], shadertorgb.inputs[0]) 83 | 84 | links.new(colorramp1.outputs[0], mixshader.inputs[0]) 85 | links.new(voronoi.outputs[0], colorramp1.inputs[0]) 86 | links.new(fresnel.outputs[0], diffuse.inputs[0]) 87 | links.new(fresnel.outputs[0], voronoi.inputs[0]) 88 | 89 | bpy.context.object.data.materials.append(smokemat) 90 | 91 | 92 | class OBJECT_OT_generateSmokeRing(bpy.types.Operator): 93 | """Create a stylized smoke ring""" 94 | bl_idname = "mesh.generate_smoke_ring" 95 | bl_label = "Add Stylized Smoke Ring" 96 | bl_options = {'REGISTER', 'UNDO'} 97 | 98 | def execute(self, context): 99 | 100 | generateSmokeRing() 101 | #assignDrivers() 102 | 103 | return {'FINISHED'} 104 | -------------------------------------------------------------------------------- /Objects/SmokeTrail.py: -------------------------------------------------------------------------------- 1 | # Smoke Trail Generator 2 | import bpy 3 | 4 | #from .Drivers.smokeDrivers import * 5 | 6 | def generateSmokeTrail(): 7 | 8 | bpy.ops.mesh.primitive_cylinder_add(radius=1, depth=2, end_fill_type='NOTHING', enter_editmode=False, align='WORLD', location=(0, 0, 0), scale=(1, 1, 1)) 9 | smoke = bpy.context.object 10 | smoke.name = 'SmokeTrail' 11 | bpy.ops.object.shade_smooth() 12 | 13 | smoketex = bpy.data.textures.new(name='Clouds', type = 'CLOUDS') 14 | smoketex.noise_scale = 1.0 15 | 16 | bpy.ops.object.modifier_add(type='ARRAY') 17 | array = smoke.modifiers["Array"] 18 | array.relative_offset_displace[0] = 0 19 | array.relative_offset_displace[2] = 1 20 | array.use_merge_vertices = True 21 | 22 | bpy.ops.object.modifier_add(type='SUBSURF') 23 | subsurf = smoke.modifiers["Subdivision"] 24 | subsurf.levels = 2 25 | subsurf.render_levels = 2 26 | 27 | bpy.ops.object.modifier_add(type='DISPLACE') 28 | displace0 = smoke.modifiers["Displace"] 29 | displace0.texture_coords = 'GLOBAL' 30 | displace0.texture = smoketex 31 | 32 | bpy.ops.object.modifier_add(type='SUBSURF') 33 | subsurf1 = smoke.modifiers["Subdivision.001"] 34 | subsurf1.levels = 2 35 | subsurf1.render_levels = 2 36 | 37 | bpy.ops.object.modifier_add(type='DISPLACE') 38 | displace1 = smoke.modifiers["Displace.001"] 39 | displace1.mid_level = 0.9 40 | 41 | smokemat = bpy.data.materials.new(name='smokeMaterial') 42 | smokemat.use_nodes = True 43 | smokemat.blend_method = 'BLEND' 44 | smokemat.shadow_method = 'NONE' 45 | smokemat.show_transparent_back = False 46 | smokemat.node_tree.nodes.clear() 47 | 48 | nodes = smokemat.node_tree.nodes 49 | 50 | output = nodes.new(type='ShaderNodeOutputMaterial') 51 | 52 | mixshader = nodes.new(type='ShaderNodeMixShader') 53 | 54 | transparent = nodes.new(type='ShaderNodeBsdfTransparent') 55 | 56 | colorramp0 = nodes.new(type='ShaderNodeValToRGB') 57 | colorramp0.color_ramp.interpolation = 'CONSTANT' 58 | colorramp0.color_ramp.elements.new(0.5) 59 | colorramp0.color_ramp.elements[0].color = [0.056122, 0.056122, 0.056122, 1.000000] 60 | colorramp0.color_ramp.elements[1].color = [0.104094, 0.104094, 0.104094, 1.000000] 61 | colorramp0.color_ramp.elements[2].color = [0.369217, 0.369217, 0.369217, 1.000000] 62 | colorramp0.color_ramp.elements[1].position = 0.01 63 | colorramp0.color_ramp.elements[2].position = 0.1 64 | 65 | shadertorgb = nodes.new(type='ShaderNodeShaderToRGB') 66 | 67 | diffuse = nodes.new(type='ShaderNodeBsdfDiffuse') 68 | 69 | colorramp1 = nodes.new(type='ShaderNodeValToRGB') 70 | colorramp1.color_ramp.interpolation = 'CONSTANT' 71 | colorramp1.color_ramp.elements[0].color = [0.0, 0.0, 0.0, 1.0] 72 | colorramp1.color_ramp.elements[1].color = [1.0, 1.0, 1.0, 1.0] 73 | colorramp1.color_ramp.elements[1].position = 1.0 74 | 75 | voronoi = nodes.new(type='ShaderNodeTexVoronoi') 76 | voronoi.voronoi_dimensions = '2D' 77 | 78 | fresnel = nodes.new(type='ShaderNodeFresnel') 79 | 80 | links = smokemat.node_tree.links 81 | 82 | links.new(mixshader.outputs[0], output.inputs[0]) 83 | 84 | links.new(transparent.outputs[0], mixshader.inputs[2]) 85 | 86 | links.new(colorramp0.outputs[0], mixshader.inputs[1]) 87 | links.new(shadertorgb.outputs[0], colorramp0.inputs[0]) 88 | links.new(diffuse.outputs[0], shadertorgb.inputs[0]) 89 | 90 | links.new(colorramp1.outputs[0], mixshader.inputs[0]) 91 | links.new(voronoi.outputs[0], colorramp1.inputs[0]) 92 | links.new(fresnel.outputs[0], diffuse.inputs[0]) 93 | links.new(fresnel.outputs[0], voronoi.inputs[0]) 94 | 95 | bpy.context.object.data.materials.append(smokemat) 96 | 97 | 98 | class OBJECT_OT_generateSmokeTrail(bpy.types.Operator): 99 | """Create a stylized smoke trail""" 100 | bl_idname = "mesh.generate_smoke_trail" 101 | bl_label = "Add Stylized Smoke Trail" 102 | bl_options = {'REGISTER', 'UNDO'} 103 | 104 | def execute(self, context): 105 | 106 | generateSmokeTrail() 107 | #assignDrivers() 108 | 109 | return {'FINISHED'} 110 | -------------------------------------------------------------------------------- /__init__.py: -------------------------------------------------------------------------------- 1 | bl_info = { 2 | "name": "Ghibli Generator", 3 | "author": "Spectral Vectors", 4 | "version": (0, 8, 5), 5 | "blender": (2, 80, 0), 6 | "location": "View 3D > Properties Panel", 7 | "description": "Procedural Anime Assets", 8 | "warning": "", 9 | "doc_url": "https://github.com/SpectralVectors/GhibliGenerator", 10 | "category": "Object", 11 | } 12 | 13 | import bpy 14 | 15 | from bpy.app.handlers import persistent 16 | 17 | from .Backgrounds import * 18 | 19 | from .Effects.ActionPlanes import * 20 | from .Effects.ColorFlashPlane import * 21 | from .Effects.GradientFlashPlane import * 22 | from .Effects.CircularFlashPlane import * 23 | 24 | from .GroundPlanes.GrassPlane import * 25 | from .GroundPlanes.WaterPlanes import * 26 | from .GroundPlanes.SandPlane import * 27 | from .GroundPlanes.IcePlane import * 28 | from .GroundPlanes.StonePathPlane import * 29 | from .GroundPlanes.RockWallPlane import * 30 | from .GroundPlanes.RoadPlane import * 31 | 32 | from .Objects.RainPlane import * 33 | from .Objects.FirePlane import * 34 | from .Objects.Rock import * 35 | from .Objects.SmokeCloud import * 36 | from .Objects.SmokeRing import * 37 | from .Objects.SmokeTrail import * 38 | from .Objects.Explosion import * 39 | from .Objects.EnergyRing import * 40 | from .Objects.EnergySphere import * 41 | from .Objects.ElectricArcSphere import * 42 | from .Objects.HeatRipplePlane import * 43 | 44 | @persistent 45 | def addon_enabler(dummy): 46 | bpy.ops.preferences.addon_enable(module="add_curve_sapling") 47 | bpy.ops.preferences.addon_enable(module="node_arrange") 48 | 49 | class GhibliGeneratorPanel(bpy.types.Panel): 50 | bl_label = "Ghibli Generator" 51 | bl_category = "Ghibli Generator" 52 | bl_idname = "VIEW3D_PT_GhibliGeneratorPanel" 53 | bl_space_type = 'VIEW_3D' 54 | bl_region_type = 'UI' 55 | 56 | def draw(self, context): 57 | 58 | layout = self.layout 59 | column = layout.column() 60 | column.label(text="Procedural Anime Assets") 61 | 62 | box = layout.box() 63 | row = box.row() 64 | icon = 'TRIA_DOWN' if context.scene.groundplanes_panel_open else 'TRIA_RIGHT' 65 | row.prop(context.scene, 'groundplanes_panel_open', icon=icon, icon_only=True) 66 | row.label(text="Ground Planes") 67 | if context.scene.groundplanes_panel_open: 68 | column = box.column() 69 | try: 70 | column.operator(OBJECT_OT_generateGrassPlane.bl_idname, text='Grass', icon='HAIR') 71 | except TypeError: 72 | column.operator(OBJECT_OT_generateGrassPlane.bl_idname, text='Grass', icon='STRANDS') 73 | column.operator(OBJECT_OT_generateWaterPlanes.bl_idname, text='Water', icon='MOD_OCEAN') 74 | column.operator(OBJECT_OT_generateSandPlane.bl_idname, text='Sand', icon='RNDCURVE') 75 | column.operator(OBJECT_OT_generateIcePlane.bl_idname, text='Ice', icon='FREEZE') 76 | column.operator(OBJECT_OT_generateStonePathPlane.bl_idname, text='Stone Path', icon='POINTCLOUD_DATA') 77 | column.operator(OBJECT_OT_generateRockWallPlane.bl_idname, text='Rock Wall', icon='LINCURVE') 78 | column.operator(OBJECT_OT_generateRoadRlane.bl_idname, text='Road', icon='COLLAPSEMENU') 79 | 80 | box = layout.box() 81 | row = box.row() 82 | icon = 'TRIA_DOWN' if context.scene.objects_panel_open else 'TRIA_RIGHT' 83 | row.prop(context.scene, 'objects_panel_open', icon=icon, icon_only=True) 84 | row.label(text="Objects") 85 | if context.scene.objects_panel_open: 86 | column = box.column() 87 | column.operator(OBJECT_OT_generateRock.bl_idname, text='Rock', icon='MESH_CAPSULE') 88 | column.operator(OBJECT_OT_generateRainPlane.bl_idname, text='Rain Plane', icon='MOD_FLUIDSIM') 89 | column.operator(OBJECT_OT_generateSmokeCloud.bl_idname, text='Smoke Cloud', icon='MOD_FLUID') 90 | column.operator(OBJECT_OT_generateSmokeRing.bl_idname, text='Smoke Ring', icon='RADIOBUT_OFF') 91 | column.operator(OBJECT_OT_generateSmokeTrail.bl_idname, text='Smoke Trail', icon='FORCE_FLUIDFLOW') 92 | column.operator(OBJECT_OT_generateExplosion.bl_idname, text='Explosion', icon='SORTBYEXT') 93 | column.operator(OBJECT_OT_generateEnergyRing.bl_idname, text='Energy Ring', icon='TRIA_DOWN_BAR') 94 | column.operator(OBJECT_OT_generateEnergySphere.bl_idname, text='Energy Sphere', icon='SHADING_RENDERED') 95 | column.operator(OBJECT_OT_generateElectricArcSphere.bl_idname, text='Electric Arc Sphere', icon='MOD_SMOOTH') 96 | column.operator(OBJECT_OT_generateFirePlane.bl_idname, text='Fire Plane', icon='SEQ_HISTOGRAM') 97 | column.operator(OBJECT_OT_generateHeatRipplePlane.bl_idname, text='Heat Ripple', icon='FORCE_TURBULENCE') 98 | 99 | box = layout.box() 100 | row = box.row() 101 | icon = 'TRIA_DOWN' if context.scene.effects_panel_open else 'TRIA_RIGHT' 102 | row.prop(context.scene, 'effects_panel_open', icon=icon, icon_only=True) 103 | row.label(text="BG Effects") 104 | if context.scene.effects_panel_open: 105 | column = box.column() 106 | column.operator(OBJECT_OT_generateActionPlanes.bl_idname, text='Action Planes', icon='MOD_OPACITY') 107 | column.operator(OBJECT_OT_generateColorFlashPlane.bl_idname, text='Color Flash', icon='MATPLANE') 108 | column.operator(OBJECT_OT_generateGradientFlashPlane.bl_idname, text='Gradient Flash', icon='NODE_TEXTURE') 109 | column.operator(OBJECT_OT_generateCircularFlashPlane.bl_idname, text='Circular Flash', icon='CLIPUV_DEHLT') 110 | 111 | box = layout.box() 112 | row = box.row() 113 | icon = 'TRIA_DOWN' if context.scene.backgrounds_panel_open else 'TRIA_RIGHT' 114 | row.prop(context.scene, 'backgrounds_panel_open', icon=icon, icon_only=True) 115 | row.label(text="World Backgrounds") 116 | if context.scene.backgrounds_panel_open: 117 | column = box.column() 118 | column.operator(OBJECT_OT_generateBlueSkyBG.bl_idname, text='Blue Sky', icon='LIGHT_SUN') 119 | column.operator(OBJECT_OT_generateSunsetBG.bl_idname, text='Sunset', icon='ANCHOR_BOTTOM') 120 | column.operator(OBJECT_OT_generateOvercastBG.bl_idname, text='Overcast', icon='VOLUME_DATA') 121 | column.operator(OBJECT_OT_generateTwilightBG.bl_idname, text='Twilight', icon='MOD_TIME') 122 | column.operator(OBJECT_OT_generateStarryNightBG.bl_idname, text='Starry Night', icon='SOLO_OFF') 123 | column.operator(OBJECT_OT_generateDefaultBG.bl_idname, text='Default', icon='BLENDER') 124 | 125 | classes = ( 126 | # Ground Planes 127 | OBJECT_OT_generateGrassPlane, 128 | OBJECT_OT_generateWaterPlanes, 129 | OBJECT_OT_generateSandPlane, 130 | OBJECT_OT_generateIcePlane, 131 | OBJECT_OT_generateStonePathPlane, 132 | OBJECT_OT_generateRockWallPlane, 133 | OBJECT_OT_generateRoadRlane, 134 | 135 | # Objects 136 | OBJECT_OT_generateRock, 137 | OBJECT_OT_generateSmokeCloud, 138 | OBJECT_OT_generateSmokeRing, 139 | OBJECT_OT_generateSmokeTrail, 140 | OBJECT_OT_generateExplosion, 141 | OBJECT_OT_generateRainPlane, 142 | OBJECT_OT_generateEnergyRing, 143 | OBJECT_OT_generateEnergySphere, 144 | OBJECT_OT_generateElectricArcSphere, 145 | OBJECT_OT_generateFirePlane, 146 | OBJECT_OT_generateHeatRipplePlane, 147 | 148 | # Effects 149 | OBJECT_OT_generateActionPlanes, 150 | OBJECT_OT_generateColorFlashPlane, 151 | OBJECT_OT_generateGradientFlashPlane, 152 | OBJECT_OT_generateCircularFlashPlane, 153 | 154 | # Backgrounds 155 | OBJECT_OT_generateBlueSkyBG, 156 | OBJECT_OT_generateSunsetBG, 157 | OBJECT_OT_generateTwilightBG, 158 | OBJECT_OT_generateOvercastBG, 159 | OBJECT_OT_generateStarryNightBG, 160 | OBJECT_OT_generateDefaultBG, 161 | 162 | # UI 163 | GhibliGeneratorPanel, 164 | ) 165 | 166 | 167 | def register(): 168 | 169 | bpy.types.Scene.groundplanes_panel_open = bpy.props.BoolProperty( 170 | default=False 171 | ) 172 | 173 | bpy.types.Scene.objects_panel_open = bpy.props.BoolProperty( 174 | default=False 175 | ) 176 | 177 | bpy.types.Scene.effects_panel_open = bpy.props.BoolProperty( 178 | default=False 179 | ) 180 | 181 | bpy.types.Scene.backgrounds_panel_open = bpy.props.BoolProperty( 182 | default=False 183 | ) 184 | 185 | bpy.app.handlers.load_post.append(addon_enabler) 186 | 187 | from bpy.utils import register_class 188 | for cls in classes: 189 | register_class(cls) 190 | 191 | 192 | def unregister(): 193 | from bpy.utils import unregister_class 194 | for cls in reversed(classes): 195 | unregister_class(cls) 196 | 197 | bpy.app.handlers.load_post.remove(addon_enabler) 198 | 199 | 200 | if __name__ == "__package__": 201 | register() 202 | -------------------------------------------------------------------------------- /screenshots/ActionPlanes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SpectralVectors/GhibliGenerator/236cd4aaf488849316b2c557a61772262fb91b94/screenshots/ActionPlanes.png -------------------------------------------------------------------------------- /screenshots/BlueSky.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SpectralVectors/GhibliGenerator/236cd4aaf488849316b2c557a61772262fb91b94/screenshots/BlueSky.png -------------------------------------------------------------------------------- /screenshots/CircularFlash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SpectralVectors/GhibliGenerator/236cd4aaf488849316b2c557a61772262fb91b94/screenshots/CircularFlash.png -------------------------------------------------------------------------------- /screenshots/ColorFlash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SpectralVectors/GhibliGenerator/236cd4aaf488849316b2c557a61772262fb91b94/screenshots/ColorFlash.png -------------------------------------------------------------------------------- /screenshots/ElectricArc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SpectralVectors/GhibliGenerator/236cd4aaf488849316b2c557a61772262fb91b94/screenshots/ElectricArc.png -------------------------------------------------------------------------------- /screenshots/EnergyRing.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SpectralVectors/GhibliGenerator/236cd4aaf488849316b2c557a61772262fb91b94/screenshots/EnergyRing.png -------------------------------------------------------------------------------- /screenshots/EnergySphere.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SpectralVectors/GhibliGenerator/236cd4aaf488849316b2c557a61772262fb91b94/screenshots/EnergySphere.png -------------------------------------------------------------------------------- /screenshots/Explosion.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SpectralVectors/GhibliGenerator/236cd4aaf488849316b2c557a61772262fb91b94/screenshots/Explosion.png -------------------------------------------------------------------------------- /screenshots/FirePlane.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SpectralVectors/GhibliGenerator/236cd4aaf488849316b2c557a61772262fb91b94/screenshots/FirePlane.png -------------------------------------------------------------------------------- /screenshots/GhibliGenerator.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SpectralVectors/GhibliGenerator/236cd4aaf488849316b2c557a61772262fb91b94/screenshots/GhibliGenerator.PNG -------------------------------------------------------------------------------- /screenshots/GradientFlash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SpectralVectors/GhibliGenerator/236cd4aaf488849316b2c557a61772262fb91b94/screenshots/GradientFlash.png -------------------------------------------------------------------------------- /screenshots/GrassPlane.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SpectralVectors/GhibliGenerator/236cd4aaf488849316b2c557a61772262fb91b94/screenshots/GrassPlane.png -------------------------------------------------------------------------------- /screenshots/HeatRipple.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SpectralVectors/GhibliGenerator/236cd4aaf488849316b2c557a61772262fb91b94/screenshots/HeatRipple.png -------------------------------------------------------------------------------- /screenshots/IcePlane.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SpectralVectors/GhibliGenerator/236cd4aaf488849316b2c557a61772262fb91b94/screenshots/IcePlane.png -------------------------------------------------------------------------------- /screenshots/Overcast.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SpectralVectors/GhibliGenerator/236cd4aaf488849316b2c557a61772262fb91b94/screenshots/Overcast.png -------------------------------------------------------------------------------- /screenshots/RainPlane.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SpectralVectors/GhibliGenerator/236cd4aaf488849316b2c557a61772262fb91b94/screenshots/RainPlane.png -------------------------------------------------------------------------------- /screenshots/RoadPlane.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SpectralVectors/GhibliGenerator/236cd4aaf488849316b2c557a61772262fb91b94/screenshots/RoadPlane.png -------------------------------------------------------------------------------- /screenshots/Rock.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SpectralVectors/GhibliGenerator/236cd4aaf488849316b2c557a61772262fb91b94/screenshots/Rock.png -------------------------------------------------------------------------------- /screenshots/RockWallPlane.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SpectralVectors/GhibliGenerator/236cd4aaf488849316b2c557a61772262fb91b94/screenshots/RockWallPlane.png -------------------------------------------------------------------------------- /screenshots/SandPlane.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SpectralVectors/GhibliGenerator/236cd4aaf488849316b2c557a61772262fb91b94/screenshots/SandPlane.png -------------------------------------------------------------------------------- /screenshots/SmokeCloud.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SpectralVectors/GhibliGenerator/236cd4aaf488849316b2c557a61772262fb91b94/screenshots/SmokeCloud.png -------------------------------------------------------------------------------- /screenshots/SmokeRing.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SpectralVectors/GhibliGenerator/236cd4aaf488849316b2c557a61772262fb91b94/screenshots/SmokeRing.png -------------------------------------------------------------------------------- /screenshots/SmokeTrail.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SpectralVectors/GhibliGenerator/236cd4aaf488849316b2c557a61772262fb91b94/screenshots/SmokeTrail.png -------------------------------------------------------------------------------- /screenshots/StarryNight.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SpectralVectors/GhibliGenerator/236cd4aaf488849316b2c557a61772262fb91b94/screenshots/StarryNight.png -------------------------------------------------------------------------------- /screenshots/StonePath.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SpectralVectors/GhibliGenerator/236cd4aaf488849316b2c557a61772262fb91b94/screenshots/StonePath.png -------------------------------------------------------------------------------- /screenshots/Sunset.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SpectralVectors/GhibliGenerator/236cd4aaf488849316b2c557a61772262fb91b94/screenshots/Sunset.png -------------------------------------------------------------------------------- /screenshots/Twilight.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SpectralVectors/GhibliGenerator/236cd4aaf488849316b2c557a61772262fb91b94/screenshots/Twilight.png -------------------------------------------------------------------------------- /screenshots/WaterPlanes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SpectralVectors/GhibliGenerator/236cd4aaf488849316b2c557a61772262fb91b94/screenshots/WaterPlanes.png --------------------------------------------------------------------------------