Changeset View
Changeset View
Standalone View
Standalone View
release/scripts/startup/bl_ui/properties_physics_field.py
| Show All 21 Lines | class PhysicButtonsPanel: | ||||
| @staticmethod | @staticmethod | ||||
| def poll_collision(context): | def poll_collision(context): | ||||
| ob = context.object | ob = context.object | ||||
| return (ob and ob.type == 'MESH') and (context.collision) | return (ob and ob.type == 'MESH') and (context.collision) | ||||
| class PHYSICS_PT_field(PhysicButtonsPanel, Panel): | class PHYSICS_PT_field(PhysicButtonsPanel, Panel): | ||||
| bl_label = "Force Fields" | bl_label = "Force Fields" | ||||
| COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_EEVEE_NEXT', 'BLENDER_WORKBENCH'} | COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_EEVEE_NEXT', 'BLENDER_WORKBENCH','BLENDER_WORKBENCH_NEXT'} | ||||
| @classmethod | @classmethod | ||||
| def poll(cls, context): | def poll(cls, context): | ||||
| if not PhysicButtonsPanel.poll_force_field(context): | if not PhysicButtonsPanel.poll_force_field(context): | ||||
| return False | return False | ||||
| return (context.engine in cls.COMPAT_ENGINES) | return (context.engine in cls.COMPAT_ENGINES) | ||||
| def draw(self, context): | def draw(self, context): | ||||
| layout = self.layout | layout = self.layout | ||||
| layout.use_property_split = True | layout.use_property_split = True | ||||
| ob = context.object | ob = context.object | ||||
| field = ob.field | field = ob.field | ||||
| layout.prop(field, "type") | layout.prop(field, "type") | ||||
| class PHYSICS_PT_field_settings(PhysicButtonsPanel, Panel): | class PHYSICS_PT_field_settings(PhysicButtonsPanel, Panel): | ||||
| bl_label = "Settings" | bl_label = "Settings" | ||||
| bl_parent_id = 'PHYSICS_PT_field' | bl_parent_id = 'PHYSICS_PT_field' | ||||
| COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_EEVEE_NEXT', 'BLENDER_WORKBENCH'} | COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_EEVEE_NEXT', 'BLENDER_WORKBENCH','BLENDER_WORKBENCH_NEXT'} | ||||
| @classmethod | @classmethod | ||||
| def poll(cls, context): | def poll(cls, context): | ||||
| if not PhysicButtonsPanel.poll_force_field(context): | if not PhysicButtonsPanel.poll_force_field(context): | ||||
| return False | return False | ||||
| return (context.engine in cls.COMPAT_ENGINES) | return (context.engine in cls.COMPAT_ENGINES) | ||||
| ▲ Show 20 Lines • Show All 70 Lines • ▼ Show 20 Lines | def draw(self, context): | ||||
| else: | else: | ||||
| del flow | del flow | ||||
| basic_force_field_settings_ui(self, field) | basic_force_field_settings_ui(self, field) | ||||
| class PHYSICS_PT_field_settings_kink(PhysicButtonsPanel, Panel): | class PHYSICS_PT_field_settings_kink(PhysicButtonsPanel, Panel): | ||||
| bl_label = "Kink" | bl_label = "Kink" | ||||
| bl_parent_id = 'PHYSICS_PT_field_settings' | bl_parent_id = 'PHYSICS_PT_field_settings' | ||||
| COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_EEVEE_NEXT', 'BLENDER_WORKBENCH'} | COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_EEVEE_NEXT', 'BLENDER_WORKBENCH','BLENDER_WORKBENCH_NEXT'} | ||||
| @classmethod | @classmethod | ||||
| def poll(cls, context): | def poll(cls, context): | ||||
| if not PhysicButtonsPanel.poll_force_field(context): | if not PhysicButtonsPanel.poll_force_field(context): | ||||
| return False | return False | ||||
| ob = context.object | ob = context.object | ||||
| return ((ob.field.type == 'GUIDE') and (context.engine in cls.COMPAT_ENGINES)) | return ((ob.field.type == 'GUIDE') and (context.engine in cls.COMPAT_ENGINES)) | ||||
| Show All 17 Lines | def draw(self, context): | ||||
| col = flow.column() | col = flow.column() | ||||
| col.prop(field, "guide_kink_shape") | col.prop(field, "guide_kink_shape") | ||||
| col.prop(field, "guide_kink_amplitude") | col.prop(field, "guide_kink_amplitude") | ||||
| class PHYSICS_PT_field_settings_texture_select(PhysicButtonsPanel, Panel): | class PHYSICS_PT_field_settings_texture_select(PhysicButtonsPanel, Panel): | ||||
| bl_label = "Texture" | bl_label = "Texture" | ||||
| bl_parent_id = 'PHYSICS_PT_field_settings' | bl_parent_id = 'PHYSICS_PT_field_settings' | ||||
| COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_EEVEE_NEXT', 'BLENDER_WORKBENCH'} | COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_EEVEE_NEXT', 'BLENDER_WORKBENCH','BLENDER_WORKBENCH_NEXT'} | ||||
| @classmethod | @classmethod | ||||
| def poll(cls, context): | def poll(cls, context): | ||||
| if not PhysicButtonsPanel.poll_force_field(context): | if not PhysicButtonsPanel.poll_force_field(context): | ||||
| return False | return False | ||||
| ob = context.object | ob = context.object | ||||
| return ((ob.field.type == 'TEXTURE') and (context.engine in cls.COMPAT_ENGINES)) | return ((ob.field.type == 'TEXTURE') and (context.engine in cls.COMPAT_ENGINES)) | ||||
| def draw(self, context): | def draw(self, context): | ||||
| layout = self.layout | layout = self.layout | ||||
| ob = context.object | ob = context.object | ||||
| field = ob.field | field = ob.field | ||||
| layout.row().template_ID(field, "texture", new="texture.new") | layout.row().template_ID(field, "texture", new="texture.new") | ||||
| class PHYSICS_PT_field_falloff(PhysicButtonsPanel, Panel): | class PHYSICS_PT_field_falloff(PhysicButtonsPanel, Panel): | ||||
| bl_label = "Falloff" | bl_label = "Falloff" | ||||
| bl_parent_id = "PHYSICS_PT_field" | bl_parent_id = "PHYSICS_PT_field" | ||||
| COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_EEVEE_NEXT', 'BLENDER_WORKBENCH'} | COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_EEVEE_NEXT', 'BLENDER_WORKBENCH','BLENDER_WORKBENCH_NEXT'} | ||||
| @classmethod | @classmethod | ||||
| def poll(cls, context): | def poll(cls, context): | ||||
| if not PhysicButtonsPanel.poll_force_field(context): | if not PhysicButtonsPanel.poll_force_field(context): | ||||
| return False | return False | ||||
| ob = context.object | ob = context.object | ||||
| return ((ob.field.type not in {'NONE', 'GUIDE'}) and (context.engine in cls.COMPAT_ENGINES)) | return ((ob.field.type not in {'NONE', 'GUIDE'}) and (context.engine in cls.COMPAT_ENGINES)) | ||||
| def draw(self, context): | def draw(self, context): | ||||
| layout = self.layout | layout = self.layout | ||||
| layout.use_property_split = True | layout.use_property_split = True | ||||
| ob = context.object | ob = context.object | ||||
| field = ob.field | field = ob.field | ||||
| layout.prop(field, "falloff_type", text="Shape") | layout.prop(field, "falloff_type", text="Shape") | ||||
| basic_force_field_falloff_ui(self, field) | basic_force_field_falloff_ui(self, field) | ||||
| class PHYSICS_PT_field_falloff_angular(PhysicButtonsPanel, Panel): | class PHYSICS_PT_field_falloff_angular(PhysicButtonsPanel, Panel): | ||||
| bl_label = "Angular" | bl_label = "Angular" | ||||
| bl_parent_id = "PHYSICS_PT_field_falloff" | bl_parent_id = "PHYSICS_PT_field_falloff" | ||||
| COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_EEVEE_NEXT', 'BLENDER_WORKBENCH'} | COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_EEVEE_NEXT', 'BLENDER_WORKBENCH','BLENDER_WORKBENCH_NEXT'} | ||||
| @classmethod | @classmethod | ||||
| def poll(cls, context): | def poll(cls, context): | ||||
| if not PhysicButtonsPanel.poll_force_field(context): | if not PhysicButtonsPanel.poll_force_field(context): | ||||
| return False | return False | ||||
| ob = context.object | ob = context.object | ||||
| return ((ob.field.falloff_type == 'CONE') and (context.engine in cls.COMPAT_ENGINES)) | return ((ob.field.falloff_type == 'CONE') and (context.engine in cls.COMPAT_ENGINES)) | ||||
| Show All 22 Lines | def draw(self, context): | ||||
| sub = col.column() | sub = col.column() | ||||
| sub.active = field.use_radial_max | sub.active = field.use_radial_max | ||||
| sub.prop(field, "radial_max", text="Max Angle") | sub.prop(field, "radial_max", text="Max Angle") | ||||
| class PHYSICS_PT_field_falloff_radial(PhysicButtonsPanel, Panel): | class PHYSICS_PT_field_falloff_radial(PhysicButtonsPanel, Panel): | ||||
| bl_label = "Radial" | bl_label = "Radial" | ||||
| bl_parent_id = "PHYSICS_PT_field_falloff" | bl_parent_id = "PHYSICS_PT_field_falloff" | ||||
| COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_EEVEE_NEXT', 'BLENDER_WORKBENCH'} | COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_EEVEE_NEXT', 'BLENDER_WORKBENCH','BLENDER_WORKBENCH_NEXT'} | ||||
| @classmethod | @classmethod | ||||
| def poll(cls, context): | def poll(cls, context): | ||||
| if not PhysicButtonsPanel.poll_force_field(context): | if not PhysicButtonsPanel.poll_force_field(context): | ||||
| return False | return False | ||||
| ob = context.object | ob = context.object | ||||
| return ((ob.field.falloff_type == 'TUBE') and (context.engine in cls.COMPAT_ENGINES)) | return ((ob.field.falloff_type == 'TUBE') and (context.engine in cls.COMPAT_ENGINES)) | ||||
| Show All 27 Lines | |||||
| def collision_warning(layout): | def collision_warning(layout): | ||||
| row = layout.row(align=True) | row = layout.row(align=True) | ||||
| row.alignment = 'RIGHT' | row.alignment = 'RIGHT' | ||||
| row.label(text="No collision settings available") | row.label(text="No collision settings available") | ||||
| class PHYSICS_PT_collision(PhysicButtonsPanel, Panel): | class PHYSICS_PT_collision(PhysicButtonsPanel, Panel): | ||||
| bl_label = "Collision" | bl_label = "Collision" | ||||
| COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_EEVEE_NEXT', 'BLENDER_WORKBENCH'} | COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_EEVEE_NEXT', 'BLENDER_WORKBENCH','BLENDER_WORKBENCH_NEXT'} | ||||
| @classmethod | @classmethod | ||||
| def poll(cls, context): | def poll(cls, context): | ||||
| if not PhysicButtonsPanel.poll_collision(context): | if not PhysicButtonsPanel.poll_collision(context): | ||||
| return False | return False | ||||
| return (context.engine in cls.COMPAT_ENGINES) | return (context.engine in cls.COMPAT_ENGINES) | ||||
| Show All 14 Lines | def draw(self, context): | ||||
| col = layout.column() | col = layout.column() | ||||
| col.prop(settings, "absorption", text="Field Absorption") | col.prop(settings, "absorption", text="Field Absorption") | ||||
| class PHYSICS_PT_collision_particle(PhysicButtonsPanel, Panel): | class PHYSICS_PT_collision_particle(PhysicButtonsPanel, Panel): | ||||
| bl_label = "Particle" | bl_label = "Particle" | ||||
| bl_parent_id = "PHYSICS_PT_collision" | bl_parent_id = "PHYSICS_PT_collision" | ||||
| COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_EEVEE_NEXT', 'BLENDER_WORKBENCH'} | COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_EEVEE_NEXT', 'BLENDER_WORKBENCH','BLENDER_WORKBENCH_NEXT'} | ||||
| @classmethod | @classmethod | ||||
| def poll(cls, context): | def poll(cls, context): | ||||
| if not PhysicButtonsPanel.poll_collision(context): | if not PhysicButtonsPanel.poll_collision(context): | ||||
| return False | return False | ||||
| return (context.engine in cls.COMPAT_ENGINES) | return (context.engine in cls.COMPAT_ENGINES) | ||||
| Show All 29 Lines | def draw(self, context): | ||||
| sub = col.column(align=True) | sub = col.column(align=True) | ||||
| sub.prop(settings, "friction_factor", text="Friction", slider=True) | sub.prop(settings, "friction_factor", text="Friction", slider=True) | ||||
| sub.prop(settings, "friction_random", text="Randomize", slider=True) | sub.prop(settings, "friction_random", text="Randomize", slider=True) | ||||
| class PHYSICS_PT_collision_softbody(PhysicButtonsPanel, Panel): | class PHYSICS_PT_collision_softbody(PhysicButtonsPanel, Panel): | ||||
| bl_label = "Softbody & Cloth" | bl_label = "Softbody & Cloth" | ||||
| bl_parent_id = "PHYSICS_PT_collision" | bl_parent_id = "PHYSICS_PT_collision" | ||||
| COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_EEVEE_NEXT', 'BLENDER_WORKBENCH'} | COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_EEVEE_NEXT', 'BLENDER_WORKBENCH','BLENDER_WORKBENCH_NEXT'} | ||||
| @classmethod | @classmethod | ||||
| def poll(cls, context): | def poll(cls, context): | ||||
| if not PhysicButtonsPanel.poll_collision(context): | if not PhysicButtonsPanel.poll_collision(context): | ||||
| return False | return False | ||||
| return (context.engine in cls.COMPAT_ENGINES) | return (context.engine in cls.COMPAT_ENGINES) | ||||
| ▲ Show 20 Lines • Show All 54 Lines • Show Last 20 Lines | |||||