[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [1068] trunk/py/scripts/addons/ object_cloud_gen.py: fixes for regenerating objects

Campbell Barton ideasman42 at gmail.com
Mon Sep 20 05:11:55 CEST 2010


Revision: 1068
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-extensions&revision=1068
Author:   campbellbarton
Date:     2010-09-20 05:11:54 +0200 (Mon, 20 Sep 2010)

Log Message:
-----------
fixes for regenerating objects
- removing objects is simplified.
- render object enabled on de-generate.
- removed warning, re-render wont crash now.

Modified Paths:
--------------
    trunk/py/scripts/addons/object_cloud_gen.py

Modified: trunk/py/scripts/addons/object_cloud_gen.py
===================================================================
--- trunk/py/scripts/addons/object_cloud_gen.py	2010-09-19 14:26:41 UTC (rev 1067)
+++ trunk/py/scripts/addons/object_cloud_gen.py	2010-09-20 03:11:54 UTC (rev 1068)
@@ -157,28 +157,10 @@
 
 
 def totallyDeleteObject(scene, obj):
-    #To Do this section to be updated when
-    #Ability to completely delet objects added to blender
-    # Deselect All
-    bpy.ops.object.select_all(action='DESELECT')
-   
-    # Select the object and delete it.
-    obj.select = True
-    scene.objects.active = obj
-   
-    # Delete all material slots in obj
-    for i in range(len(obj.material_slots)):
-       #textureSlots = cloudMaterial.texture_slots
-       obj.active_material_index = i - 1
-       bpy.ops.object.material_slot_remove()
-  
-    #bpy.ops.object.parent_clear(type='CLEAR')
+    scene.objects.unlink(obj)
+    bpy.data.objects.remove(obj)
 
-    # Delete the Main Object
-    bpy.ops.object.delete()
-    #bpy.data.objects.remove(obj)
 
-
 def makeParent(parentobj, childobj, scene):
 
     applyScaleRotLoc(scene, parentobj)
@@ -296,25 +278,7 @@
             col.label(text="objects to generate")
             col.label(text="a cloud.")
 
-cloudTypes = []
 
-cloudTypes.append(("0","Stratus","Generate Stratus_foggy Cloud"))
-cloudTypes.append(("1","Cumulous","Generate Cumulous_puffy Cloud"))
-cloudTypes.append(("2","Cirrus","Generate Cirrus_wispy Cloud"))
-#cloudTypes.append(("3","Nimbus","Generate Nimbus Cloud"))
-
-
-bpy.types.Scene.cloudparticles = BoolProperty(
-    name="Particles",
-    description="Generate Cloud as Particle System",
-    default=False)
-
-bpy.types.Scene.cloud_type = EnumProperty(
-    name="Type",
-    description="Select the type of cloud to create with material settings",
-    items=cloudTypes, default='0')
-
-
 class GenerateCloud(bpy.types.Operator):
     bl_idname = "cloud.generate_cloud"
     bl_label = "Generate Cloud"
@@ -382,11 +346,7 @@
            for eachMember in definitionObjects:
                eachMember.draw_type = 'SOLID'
                eachMember.select = True
-               #scene.objects.active = eachMember
-
-           #TODO Delete this when render bug caused by degenerate is fixed.
-           self.report({'WARNING'}, "Please save file exit and reenter blender before rendering to clean memory and prevent crash")
-
+               eachMember.hide_render = False
         else:
             # Generate Cloud
 
@@ -664,11 +624,24 @@
 
 
 def register():
-    pass
+    bpy.types.Scene.cloudparticles = BoolProperty(
+        name="Particles",
+        description="Generate Cloud as Particle System",
+        default=False)
 
+    bpy.types.Scene.cloud_type = EnumProperty(
+        name="Type",
+        description="Select the type of cloud to create with material settings",
+        items=[("0","Stratus","Generate Stratus_foggy Cloud"),
+               ("1","Cumulous","Generate Cumulous_puffy Cloud"),
+               ("2","Cirrus","Generate Cirrus_wispy Cloud"),
+              ],
+        default='0')
 
+
 def unregister():
-    pass
+    del bpy.types.Scene.cloudparticles
+    del bpy.types.Scene.cloud_type
 
 
 if __name__ == "__main__":




More information about the Bf-extensions-cvs mailing list