[Bf-blender-cvs] [bcd12bf] temp_remove_particles: Removed most partical-related code from UI scripts.

Lukas Tönne noreply at git.blender.org
Tue Apr 12 16:30:47 CEST 2016


Commit: bcd12bf64d89165385ab4782bc05d7758fde734e
Author: Lukas Tönne
Date:   Tue Apr 12 16:28:00 2016 +0200
Branches: temp_remove_particles
https://developer.blender.org/rBbcd12bf64d89165385ab4782bc05d7758fde734e

Removed most partical-related code from UI scripts.

There are a lot of cases here where deciding for removal is a bit tricky.
Many features have options for "use_particles" and similar settings. Only
features which actually store a particle object reference or work on actual
particle data have been removed.

===================================================================

D	release/scripts/presets/hair_dynamics/default.py
M	release/scripts/startup/bl_operators/object_quick_effects.py
M	release/scripts/startup/bl_operators/presets.py
M	release/scripts/startup/bl_operators/view3d.py
M	release/scripts/startup/bl_ui/__init__.py
M	release/scripts/startup/bl_ui/properties_data_modifier.py
M	release/scripts/startup/bl_ui/properties_paint_common.py
D	release/scripts/startup/bl_ui/properties_particle.py
M	release/scripts/startup/bl_ui/properties_physics_common.py
M	release/scripts/startup/bl_ui/properties_physics_dynamicpaint.py
M	release/scripts/startup/bl_ui/properties_physics_smoke.py
M	release/scripts/startup/bl_ui/properties_scene.py
M	release/scripts/startup/bl_ui/properties_texture.py
M	release/scripts/startup/bl_ui/space_dopesheet.py
M	release/scripts/startup/bl_ui/space_time.py
M	release/scripts/startup/bl_ui/space_userpref.py
M	release/scripts/startup/bl_ui/space_view3d.py
M	release/scripts/startup/bl_ui/space_view3d_toolbar.py

===================================================================

diff --git a/release/scripts/presets/hair_dynamics/default.py b/release/scripts/presets/hair_dynamics/default.py
deleted file mode 100644
index 830d28a..0000000
--- a/release/scripts/presets/hair_dynamics/default.py
+++ /dev/null
@@ -1,17 +0,0 @@
-import bpy
-psys = bpy.context.particle_system
-cloth = bpy.context.particle_system.cloth
-settings = bpy.context.particle_system.cloth.settings
-collision = bpy.context.particle_system.cloth.collision_settings
-
-settings.quality = 5
-settings.mass = 0.30000001192092896
-settings.bending_stiffness = 0.5
-psys.settings.bending_random = 0.0
-settings.bending_damping = 0.5
-settings.air_damping = 1.0
-settings.internal_friction = 0.0
-settings.density_target = 0.0
-settings.density_strength = 0.0
-settings.voxel_cell_size = 0.10000000149011612
-settings.pin_stiffness = 0.0
diff --git a/release/scripts/startup/bl_operators/object_quick_effects.py b/release/scripts/startup/bl_operators/object_quick_effects.py
index 414855c..39a0ad3 100644
--- a/release/scripts/startup/bl_operators/object_quick_effects.py
+++ b/release/scripts/startup/bl_operators/object_quick_effects.py
@@ -47,239 +47,6 @@ def object_ensure_material(obj, mat_name):
     return mat
 
 
-class QuickFur(Operator):
-    bl_idname = "object.quick_fur"
-    bl_label = "Quick Fur"
-    bl_options = {'REGISTER', 'UNDO'}
-
-    density = EnumProperty(
-            name="Fur Density",
-            items=(('LIGHT', "Light", ""),
-                   ('MEDIUM', "Medium", ""),
-                   ('HEAVY', "Heavy", "")),
-            default='MEDIUM',
-            )
-    view_percentage = IntProperty(
-            name="View %",
-            min=1, max=100,
-            soft_min=1, soft_max=100,
-            default=10,
-            )
-    length = FloatProperty(
-            name="Length",
-            min=0.001, max=100,
-            soft_min=0.01, soft_max=10,
-            default=0.1,
-            )
-
-    def execute(self, context):
-        fake_context = context.copy()
-        mesh_objects = [obj for obj in context.selected_objects
-                        if obj.type == 'MESH' and obj.mode == 'OBJECT']
-
-        if not mesh_objects:
-            self.report({'ERROR'}, "Select at least one mesh object")
-            return {'CANCELLED'}
-
-        mat = bpy.data.materials.new("Fur Material")
-        mat.strand.tip_size = 0.25
-        mat.strand.blend_distance = 0.5
-
-        for obj in mesh_objects:
-            fake_context["object"] = obj
-            bpy.ops.object.particle_system_add(fake_context)
-
-            psys = obj.particle_systems[-1]
-            psys.settings.type = 'HAIR'
-
-            if self.density == 'LIGHT':
-                psys.settings.count = 100
-            elif self.density == 'MEDIUM':
-                psys.settings.count = 1000
-            elif self.density == 'HEAVY':
-                psys.settings.count = 10000
-
-            psys.settings.child_nbr = self.view_percentage
-            psys.settings.hair_length = self.length
-            psys.settings.use_strand_primitive = True
-            psys.settings.use_hair_bspline = True
-            psys.settings.child_type = 'INTERPOLATED'
-
-            obj.data.materials.append(mat)
-            psys.settings.material = len(obj.data.materials)
-
-        return {'FINISHED'}
-
-
-class QuickExplode(Operator):
-    bl_idname = "object.quick_explode"
-    bl_label = "Quick Explode"
-    bl_options = {'REGISTER', 'UNDO'}
-
-    style = EnumProperty(
-            name="Explode Style",
-            items=(('EXPLODE', "Explode", ""),
-                   ('BLEND', "Blend", "")),
-            default='EXPLODE',
-            )
-    amount = IntProperty(
-            name="Amount of pieces",
-            min=2, max=10000,
-            soft_min=2, soft_max=10000,
-            default=100,
-            )
-    frame_duration = IntProperty(
-            name="Duration",
-            min=1, max=300000,
-            soft_min=1, soft_max=10000,
-            default=50,
-            )
-
-    frame_start = IntProperty(
-            name="Start Frame",
-            min=1, max=300000,
-            soft_min=1, soft_max=10000,
-            default=1,
-            )
-    frame_end = IntProperty(
-            name="End Frame",
-            min=1, max=300000,
-            soft_min=1, soft_max=10000,
-            default=10,
-            )
-
-    velocity = FloatProperty(
-            name="Outwards Velocity",
-            min=0, max=300000,
-            soft_min=0, soft_max=10,
-            default=1,
-            )
-
-    fade = BoolProperty(
-            name="Fade",
-            description="Fade the pieces over time",
-            default=True,
-            )
-
-    def execute(self, context):
-        fake_context = context.copy()
-        obj_act = context.active_object
-
-        if obj_act is None or obj_act.type != 'MESH':
-            self.report({'ERROR'}, "Active object is not a mesh")
-            return {'CANCELLED'}
-
-        mesh_objects = [obj for obj in context.selected_objects
-                        if obj.type == 'MESH' and obj != obj_act]
-        mesh_objects.insert(0, obj_act)
-
-        if self.style == 'BLEND' and len(mesh_objects) != 2:
-            self.report({'ERROR'}, "Select two mesh objects")
-            self.style = 'EXPLODE'
-            return {'CANCELLED'}
-        elif not mesh_objects:
-            self.report({'ERROR'}, "Select at least one mesh object")
-            return {'CANCELLED'}
-
-        for obj in mesh_objects:
-            if obj.particle_systems:
-                self.report({'ERROR'},
-                            "Object %r already has a "
-                            "particle system" % obj.name)
-
-                return {'CANCELLED'}
-
-        if self.fade:
-            tex = bpy.data.textures.new("Explode fade", 'BLEND')
-            tex.use_color_ramp = True
-
-            if self.style == 'BLEND':
-                tex.color_ramp.elements[0].position = 0.333
-                tex.color_ramp.elements[1].position = 0.666
-
-            tex.color_ramp.elements[0].color[3] = 1.0
-            tex.color_ramp.elements[1].color[3] = 0.0
-
-        if self.style == 'BLEND':
-            from_obj = mesh_objects[1]
-            to_obj = mesh_objects[0]
-
-        for obj in mesh_objects:
-            fake_context["object"] = obj
-            bpy.ops.object.particle_system_add(fake_context)
-
-            settings = obj.particle_systems[-1].settings
-            settings.count = self.amount
-            settings.frame_start = self.frame_start
-            settings.frame_end = self.frame_end - self.frame_duration
-            settings.lifetime = self.frame_duration
-            settings.normal_factor = self.velocity
-            settings.render_type = 'NONE'
-
-            explode = obj.modifiers.new(name='Explode', type='EXPLODE')
-            explode.use_edge_cut = True
-
-            if self.fade:
-                explode.show_dead = False
-                uv = obj.data.uv_textures.new("Explode fade")
-                explode.particle_uv = uv.name
-
-                mat = object_ensure_material(obj, "Explode Fade")
-
-                mat.use_transparency = True
-                mat.use_transparent_shadows = True
-                mat.alpha = 0.0
-                mat.specular_alpha = 0.0
-
-                tex_slot = mat.texture_slots.add()
-
-                tex_slot.texture = tex
-                tex_slot.texture_coords = 'UV'
-                tex_slot.uv_layer = uv.name
-
-                tex_slot.use_map_alpha = True
-
-                if self.style == 'BLEND':
-                    if obj == to_obj:
-                        tex_slot.alpha_factor = -1.0
-                        elem = tex.color_ramp.elements[1]
-                    else:
-                        elem = tex.color_ramp.elements[0]
-                    # Keep already defined alpha!
-                    elem.color[:3] = mat.diffuse_color
-                else:
-                    tex_slot.use_map_color_diffuse = False
-
-            if self.style == 'BLEND':
-                settings.physics_type = 'KEYED'
-                settings.use_emit_random = False
-                settings.rotation_mode = 'NOR'
-
-                psys = obj.particle_systems[-1]
-
-                fake_context["particle_system"] = obj.particle_systems[-1]
-                bpy.ops.particle.new_target(fake_context)
-                bpy.ops.particle.new_target(fake_context)
-
-                if obj == from_obj:
-                    psys.targets[1].object = to_obj
-                else:
-                    psys.targets[0].object = from_obj
-                    settings.normal_factor = -self.velocity
-                    explode.show_unborn = False
-                    explode.show_dead = True
-            else:
-                settings.factor_random = self.velocity
-                settings.angular_velocity_factor = self.velocity / 10.0
-
-        return {'FINISHED'}
-
-    def invoke(self, context, event):
-        self.frame_start = context.scene.frame_current
-        self.frame_end = self.frame_start + self.frame_duration
-        return self.execute(context)
-
-
 def obj_bb_minmax(obj, min_co, max_co):
     for i in range(0, 8):
         bb_vec = obj.matrix_world * Vector(obj.bound_box[i])
diff --git a/release/scripts/startup/bl_operators/presets.py b/release/scripts/startup/bl_operators/presets.py
index e01e509..ea27941 100644
--- a/release/scripts/startup/bl_operators/presets.py
+++ b/release/scripts/startup/bl_operators/presets.py
@@ -384,36 +384,6 @@ class AddPresetFluid(AddPresetBase, Operator):
     preset_subdir = "fluid"
 
 
-class AddPresetHairDynamics(AddPresetBase, Operator):
-    """Add or remove a Hair Dynamics Preset"""
-    bl_idname = "particle.hair_dynamics_preset_add"
-    bl_label = "Add Hair Dynamics Preset"
-    preset_menu = "PARTICLE_MT_hair_dynamics_presets"
-
-    preset_defines = [
-        "psys = bpy.context.particle_system",
-        "cloth = bpy.context.particle_system.cloth",
-        "settings = bpy.context.particle_system.cloth.settings",
-        "collision = bpy.context.particle_system.cloth.collision_settings",
-    ]
-
-    preset_subdir = "hair_dynamics"
-
-

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list