Changeset View
Changeset View
Standalone View
Standalone View
object_cloud_gen.py
| Show First 20 Lines • Show All 557 Lines • ▼ Show 20 Lines | def execute(self, context): | ||||
| totallyDeleteObject(scene, createdObj) | totallyDeleteObject(scene, createdObj) | ||||
| # Delete the blend_data object | # Delete the blend_data object | ||||
| totallyDeleteObject(scene, mainObj) | totallyDeleteObject(scene, mainObj) | ||||
| # Select all of the left over boxes so people can immediately | # Select all of the left over boxes so people can immediately | ||||
| # press generate again if they want | # press generate again if they want | ||||
| for eachMember in definitionObjects: | for eachMember in definitionObjects: | ||||
| eachMember.draw_type = 'SOLID' | eachMember.display_type = 'SOLID' | ||||
| eachMember.select = True | eachMember.select = True | ||||
| eachMember.hide_render = False | eachMember.hide_render = False | ||||
| elif WhatToDo == 'CLOUD_CONVERT_TO_MESH': | elif WhatToDo == 'CLOUD_CONVERT_TO_MESH': | ||||
| cloudParticles = active_object.particle_systems.active | cloudParticles = active_object.particle_systems.active | ||||
| bounds = active_object.parent | bounds = active_object.parent | ||||
| # Create CloudPnts for putting points in # | # Create CloudPnts for putting points in # | ||||
| # Create a new object cloudPnts | # Create a new object cloudPnts | ||||
| cloudPnts = addNewObject(scene, "CloudPoints", bounds) | cloudPnts = addNewObject(scene, "CloudPoints", bounds) | ||||
| cloudPnts["CloudMember"] = "CreatedObj" | cloudPnts["CloudMember"] = "CreatedObj" | ||||
| cloudPnts.draw_type = 'WIRE' | cloudPnts.display_type = 'WIRE' | ||||
| cloudPnts.hide_render = True | cloudPnts.hide_render = True | ||||
| makeParent(bounds, cloudPnts, scene) | makeParent(bounds, cloudPnts, scene) | ||||
| convertParticlesToMesh(scene, cloudParticles, cloudPnts, True) | convertParticlesToMesh(scene, cloudParticles, cloudPnts, True) | ||||
| removeParticleSystemFromObj(scene, active_object) | removeParticleSystemFromObj(scene, active_object) | ||||
| pDensity = getpdensitytexture(bounds) | pDensity = getpdensitytexture(bounds) | ||||
| pDensity.point_density.point_source = 'OBJECT' | pDensity.point_density.point_source = 'OBJECT' | ||||
| Show All 13 Lines | def execute(self, context): | ||||
| selectedObjects = [bpy.context.active_object] | selectedObjects = [bpy.context.active_object] | ||||
| # Create a new object bounds | # Create a new object bounds | ||||
| bounds = addNewObject( | bounds = addNewObject( | ||||
| scene, "CloudBounds", | scene, "CloudBounds", | ||||
| selectedObjects[0] | selectedObjects[0] | ||||
| ) | ) | ||||
| bounds.draw_type = 'BOUNDS' | bounds.display_type = 'BOUNDS' | ||||
| bounds.hide_render = False | bounds.hide_render = False | ||||
| # Just add a Definition Property designating this | # Just add a Definition Property designating this | ||||
| # as the blend_data object | # as the blend_data object | ||||
| bounds["CloudMember"] = "MainObj" | bounds["CloudMember"] = "MainObj" | ||||
| # Since we used iteration 0 to copy with object we | # Since we used iteration 0 to copy with object we | ||||
| # delete it off the list. | # delete it off the list. | ||||
| firstObject = selectedObjects[0] | firstObject = selectedObjects[0] | ||||
| del selectedObjects[0] | del selectedObjects[0] | ||||
| # Apply location Rotation and Scale to all objects involved | # Apply location Rotation and Scale to all objects involved | ||||
| applyScaleRotLoc(scene, bounds) | applyScaleRotLoc(scene, bounds) | ||||
| for each in selectedObjects: | for each in selectedObjects: | ||||
| applyScaleRotLoc(scene, each) | applyScaleRotLoc(scene, each) | ||||
| # Let's combine all of them together. | # Let's combine all of them together. | ||||
| combineObjects(scene, bounds, selectedObjects) | combineObjects(scene, bounds, selectedObjects) | ||||
| # Let's add some property info to the objects | # Let's add some property info to the objects | ||||
| for selObj in selectedObjects: | for selObj in selectedObjects: | ||||
| selObj["CloudMember"] = "DefinitionObj" | selObj["CloudMember"] = "DefinitionObj" | ||||
| selObj.name = "DefinitionObj" | selObj.name = "DefinitionObj" | ||||
| selObj.draw_type = 'WIRE' | selObj.display_type = 'WIRE' | ||||
| selObj.hide_render = True | selObj.hide_render = True | ||||
| selObj.hide = True | selObj.hide = True | ||||
| makeParent(bounds, selObj, scene) | makeParent(bounds, selObj, scene) | ||||
| # Do the same to the 1. object since it is no longer in list. | # Do the same to the 1. object since it is no longer in list. | ||||
| firstObject["CloudMember"] = "DefinitionObj" | firstObject["CloudMember"] = "DefinitionObj" | ||||
| firstObject.name = "DefinitionObj" | firstObject.name = "DefinitionObj" | ||||
| firstObject.draw_type = 'WIRE' | firstObject.display_type = 'WIRE' | ||||
| firstObject.hide_render = True | firstObject.hide_render = True | ||||
| makeParent(bounds, firstObject, scene) | makeParent(bounds, firstObject, scene) | ||||
| # Create Cloud for putting Cloud Mesh # | # Create Cloud for putting Cloud Mesh # | ||||
| # Create a new object cloud. | # Create a new object cloud. | ||||
| cloud = addNewObject(scene, "CloudMesh", bounds) | cloud = addNewObject(scene, "CloudMesh", bounds) | ||||
| cloud["CloudMember"] = "CreatedObj" | cloud["CloudMember"] = "CreatedObj" | ||||
| cloud.draw_type = 'WIRE' | cloud.display_type = 'WIRE' | ||||
| cloud.hide_render = True | cloud.hide_render = True | ||||
| makeParent(bounds, cloud, scene) | makeParent(bounds, cloud, scene) | ||||
| bpy.ops.object.editmode_toggle() | bpy.ops.object.editmode_toggle() | ||||
| bpy.ops.mesh.select_all(action='SELECT') | bpy.ops.mesh.select_all(action='SELECT') | ||||
| # Don't subdivide object or smooth if smoothing box not checked. | # Don't subdivide object or smooth if smoothing box not checked. | ||||
| Show All 14 Lines | def execute(self, context): | ||||
| # Particle settings setting it up! | # Particle settings setting it up! | ||||
| cloudParticles = cloud.particle_systems.active | cloudParticles = cloud.particle_systems.active | ||||
| cloudParticles.name = "CloudParticles" | cloudParticles.name = "CloudParticles" | ||||
| cloudParticles.settings.frame_start = 0 | cloudParticles.settings.frame_start = 0 | ||||
| cloudParticles.settings.frame_end = 0 | cloudParticles.settings.frame_end = 0 | ||||
| cloudParticles.settings.emit_from = 'VOLUME' | cloudParticles.settings.emit_from = 'VOLUME' | ||||
| cloudParticles.settings.lifetime = scene.frame_end | cloudParticles.settings.lifetime = scene.frame_end | ||||
| cloudParticles.settings.draw_method = 'DOT' | cloudParticles.settings.display_method = 'DOT' | ||||
| cloudParticles.settings.render_type = 'NONE' | cloudParticles.settings.render_type = 'NONE' | ||||
| cloudParticles.settings.distribution = 'RAND' | cloudParticles.settings.distribution = 'RAND' | ||||
| cloudParticles.settings.physics_type = 'NEWTON' | cloudParticles.settings.physics_type = 'NEWTON' | ||||
| cloudParticles.settings.normal_factor = 0 | cloudParticles.settings.normal_factor = 0 | ||||
| # Gravity does not affect the particle system | # Gravity does not affect the particle system | ||||
| eWeights = cloudParticles.settings.effector_weights | eWeights = cloudParticles.settings.effector_weights | ||||
| eWeights.gravity = 0 | eWeights.gravity = 0 | ||||
| ▲ Show 20 Lines • Show All 142 Lines • ▼ Show 20 Lines | def execute(self, context): | ||||
| # Set time to 1. | # Set time to 1. | ||||
| scene.frame_current = 1 | scene.frame_current = 1 | ||||
| if not scene.cloudparticles: | if not scene.cloudparticles: | ||||
| # Create CloudPnts for putting points in # | # Create CloudPnts for putting points in # | ||||
| # Create a new object cloudPnts | # Create a new object cloudPnts | ||||
| cloudPnts = addNewObject(scene, "CloudPoints", bounds) | cloudPnts = addNewObject(scene, "CloudPoints", bounds) | ||||
| cloudPnts["CloudMember"] = "CreatedObj" | cloudPnts["CloudMember"] = "CreatedObj" | ||||
| cloudPnts.draw_type = 'WIRE' | cloudPnts.display_type = 'WIRE' | ||||
| cloudPnts.hide_render = True | cloudPnts.hide_render = True | ||||
| makeParent(bounds, cloudPnts, scene) | makeParent(bounds, cloudPnts, scene) | ||||
| convertParticlesToMesh(scene, cloudParticles, cloudPnts, True) | convertParticlesToMesh(scene, cloudParticles, cloudPnts, True) | ||||
| # Add a modifier. | # Add a modifier. | ||||
| bpy.ops.object.modifier_add(type='DISPLACE') | bpy.ops.object.modifier_add(type='DISPLACE') | ||||
| ▲ Show 20 Lines • Show All 134 Lines • Show Last 20 Lines | |||||