Cleanup: especially non pep8 parts of Py UI
This commit is contained in:
@@ -28,11 +28,11 @@ if "bpy" in locals():
|
|||||||
import bpy
|
import bpy
|
||||||
from bpy.types import Operator
|
from bpy.types import Operator
|
||||||
from bpy.props import (
|
from bpy.props import (
|
||||||
IntProperty,
|
IntProperty,
|
||||||
BoolProperty,
|
BoolProperty,
|
||||||
EnumProperty,
|
EnumProperty,
|
||||||
StringProperty,
|
StringProperty,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class ANIM_OT_keying_set_export(Operator):
|
class ANIM_OT_keying_set_export(Operator):
|
||||||
@@ -115,30 +115,30 @@ class ANIM_OT_keying_set_export(Operator):
|
|||||||
# Find material or lamp using this node tree...
|
# Find material or lamp using this node tree...
|
||||||
id_bpy_path = "bpy.data.nodes[\"%s\"]"
|
id_bpy_path = "bpy.data.nodes[\"%s\"]"
|
||||||
found = False
|
found = False
|
||||||
|
|
||||||
for mat in bpy.data.materials:
|
for mat in bpy.data.materials:
|
||||||
if mat.node_tree == ksp.id:
|
if mat.node_tree == ksp.id:
|
||||||
id_bpy_path = "bpy.data.materials[\"%s\"].node_tree" % (mat.name)
|
id_bpy_path = "bpy.data.materials[\"%s\"].node_tree" % (mat.name)
|
||||||
found = True
|
found = True
|
||||||
break;
|
break
|
||||||
|
|
||||||
if not found:
|
if not found:
|
||||||
for lamp in bpy.data.lamps:
|
for lamp in bpy.data.lamps:
|
||||||
if lamp.node_tree == ksp.id:
|
if lamp.node_tree == ksp.id:
|
||||||
id_bpy_path = "bpy.data.lamps[\"%s\"].node_tree" % (lamp.name)
|
id_bpy_path = "bpy.data.lamps[\"%s\"].node_tree" % (lamp.name)
|
||||||
found = True
|
found = True
|
||||||
break;
|
break
|
||||||
|
|
||||||
if not found:
|
if not found:
|
||||||
self.report({'WARN'}, "Could not find material or lamp using Shader Node Tree - %s" % (ksp.id))
|
self.report({'WARN'}, "Could not find material or lamp using Shader Node Tree - %s" % (ksp.id))
|
||||||
elif ksp.id.bl_rna.identifier.startswith("CompositorNodeTree"):
|
elif ksp.id.bl_rna.identifier.startswith("CompositorNodeTree"):
|
||||||
# Find compositor nodetree using this node tree...
|
# Find compositor nodetree using this node tree...
|
||||||
for scene in bpy.data.scenes:
|
for scene in bpy.data.scenes:
|
||||||
if scene.node_tree == ksp.id:
|
if scene.node_tree == ksp.id:
|
||||||
id_bpy_path = "bpy.data.scenes[\"%s\"].node_tree" % (scene.name)
|
id_bpy_path = "bpy.data.scenes[\"%s\"].node_tree" % (scene.name)
|
||||||
break;
|
break
|
||||||
else:
|
else:
|
||||||
self.report({'WARN'}, "Could not find scene using Compositor Node Tree - %s" % (ksp.id))
|
self.report({'WARN'}, "Could not find scene using Compositor Node Tree - %s" % (ksp.id))
|
||||||
else:
|
else:
|
||||||
idtype_list = ksp.id.bl_rna.name.lower() + "s"
|
idtype_list = ksp.id.bl_rna.name.lower() + "s"
|
||||||
id_bpy_path = "bpy.data.%s[\"%s\"]" % (idtype_list, ksp.id.name)
|
id_bpy_path = "bpy.data.%s[\"%s\"]" % (idtype_list, ksp.id.name)
|
||||||
@@ -302,9 +302,11 @@ class ClearUselessActions(Operator):
|
|||||||
bl_label = "Clear Useless Actions"
|
bl_label = "Clear Useless Actions"
|
||||||
bl_options = {'REGISTER', 'UNDO'}
|
bl_options = {'REGISTER', 'UNDO'}
|
||||||
|
|
||||||
only_unused = BoolProperty(name="Only Unused",
|
only_unused = BoolProperty(
|
||||||
|
name="Only Unused",
|
||||||
description="Only unused (Fake User only) actions get considered",
|
description="Only unused (Fake User only) actions get considered",
|
||||||
default=True)
|
default=True,
|
||||||
|
)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def poll(cls, context):
|
def poll(cls, context):
|
||||||
@@ -393,7 +395,7 @@ class UpdateAnimatedTransformConstraint(Operator):
|
|||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
ret = (data, new_path)
|
ret = (data, new_path)
|
||||||
#print(ret)
|
# print(ret)
|
||||||
|
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
@@ -419,4 +421,4 @@ classes = (
|
|||||||
BakeAction,
|
BakeAction,
|
||||||
ClearUselessActions,
|
ClearUselessActions,
|
||||||
UpdateAnimatedTransformConstraint,
|
UpdateAnimatedTransformConstraint,
|
||||||
)
|
)
|
||||||
|
@@ -71,6 +71,7 @@ class MATERIAL_MT_specials(Menu):
|
|||||||
|
|
||||||
|
|
||||||
class MATERIAL_UL_matslots(UIList):
|
class MATERIAL_UL_matslots(UIList):
|
||||||
|
|
||||||
def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index):
|
def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index):
|
||||||
# assert(isinstance(item, bpy.types.MaterialSlot)
|
# assert(isinstance(item, bpy.types.MaterialSlot)
|
||||||
# ob = data
|
# ob = data
|
||||||
|
@@ -23,11 +23,11 @@ from rna_prop_ui import PropertyPanel
|
|||||||
from bpy.app.translations import pgettext_iface as iface_
|
from bpy.app.translations import pgettext_iface as iface_
|
||||||
|
|
||||||
from bl_ui.properties_physics_common import (
|
from bl_ui.properties_physics_common import (
|
||||||
point_cache_ui,
|
point_cache_ui,
|
||||||
effector_weights_ui,
|
effector_weights_ui,
|
||||||
basic_force_field_settings_ui,
|
basic_force_field_settings_ui,
|
||||||
basic_force_field_falloff_ui,
|
basic_force_field_falloff_ui,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def particle_panel_enabled(context, psys):
|
def particle_panel_enabled(context, psys):
|
||||||
@@ -108,6 +108,7 @@ def find_modifier(ob, psys):
|
|||||||
|
|
||||||
|
|
||||||
class PARTICLE_UL_particle_systems(bpy.types.UIList):
|
class PARTICLE_UL_particle_systems(bpy.types.UIList):
|
||||||
|
|
||||||
def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index, flt_flag):
|
def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index, flt_flag):
|
||||||
ob = data
|
ob = data
|
||||||
psys = item
|
psys = item
|
||||||
@@ -117,8 +118,10 @@ class PARTICLE_UL_particle_systems(bpy.types.UIList):
|
|||||||
|
|
||||||
layout.prop(psys, "name", text="", emboss=False, icon_value=icon)
|
layout.prop(psys, "name", text="", emboss=False, icon_value=icon)
|
||||||
if md:
|
if md:
|
||||||
layout.prop(md, "show_render", emboss=False, icon_only=True, icon='RESTRICT_RENDER_OFF' if md.show_render else 'RESTRICT_RENDER_ON')
|
layout.prop(md, "show_render", emboss=False, icon_only=True,
|
||||||
layout.prop(md, "show_viewport", emboss=False, icon_only=True, icon='RESTRICT_VIEW_OFF' if md.show_viewport else 'RESTRICT_VIEW_ON')
|
icon='RESTRICT_RENDER_OFF' if md.show_render else 'RESTRICT_RENDER_ON')
|
||||||
|
layout.prop(md, "show_viewport", emboss=False, icon_only=True,
|
||||||
|
icon='RESTRICT_VIEW_OFF' if md.show_viewport else 'RESTRICT_VIEW_ON')
|
||||||
|
|
||||||
elif self.layout_type == 'GRID':
|
elif self.layout_type == 'GRID':
|
||||||
layout.alignment = 'CENTER'
|
layout.alignment = 'CENTER'
|
||||||
@@ -401,7 +404,8 @@ class PARTICLE_PT_hair_dynamics(ParticleButtonsPanel, Panel):
|
|||||||
label = "ERROR"
|
label = "ERROR"
|
||||||
icon = 'ERROR'
|
icon = 'ERROR'
|
||||||
box.label(label, icon=icon)
|
box.label(label, icon=icon)
|
||||||
box.label("Iterations: %d .. %d (avg. %d)" % (result.min_iterations, result.max_iterations, result.avg_iterations))
|
box.label("Iterations: %d .. %d (avg. %d)" %
|
||||||
|
(result.min_iterations, result.max_iterations, result.avg_iterations))
|
||||||
box.label("Error: %.5f .. %.5f (avg. %.5f)" % (result.min_error, result.max_error, result.avg_error))
|
box.label("Error: %.5f .. %.5f (avg. %.5f)" % (result.min_error, result.max_error, result.avg_error))
|
||||||
|
|
||||||
|
|
||||||
@@ -423,7 +427,12 @@ class PARTICLE_PT_cache(ParticleButtonsPanel, Panel):
|
|||||||
phystype = psys.settings.physics_type
|
phystype = psys.settings.physics_type
|
||||||
if phystype == 'NO' or phystype == 'KEYED':
|
if phystype == 'NO' or phystype == 'KEYED':
|
||||||
return False
|
return False
|
||||||
return (psys.settings.type in {'EMITTER', 'REACTOR'} or (psys.settings.type == 'HAIR' and (psys.use_hair_dynamics or psys.point_cache.is_baked))) and engine in cls.COMPAT_ENGINES
|
return (
|
||||||
|
(psys.settings.type in {'EMITTER', 'REACTOR'} or
|
||||||
|
(psys.settings.type == 'HAIR' and
|
||||||
|
(psys.use_hair_dynamics or psys.point_cache.is_baked))) and
|
||||||
|
engine in cls.COMPAT_ENGINES
|
||||||
|
)
|
||||||
|
|
||||||
def draw(self, context):
|
def draw(self, context):
|
||||||
psys = context.particle_system
|
psys = context.particle_system
|
||||||
@@ -743,7 +752,8 @@ class PARTICLE_PT_physics(ParticleButtonsPanel, Panel):
|
|||||||
layout.label(text="Fluid interaction:")
|
layout.label(text="Fluid interaction:")
|
||||||
|
|
||||||
row = layout.row()
|
row = layout.row()
|
||||||
row.template_list("UI_UL_list", "particle_targets", psys, "targets", psys, "active_particle_target_index", rows=4)
|
row.template_list("UI_UL_list", "particle_targets", psys, "targets",
|
||||||
|
psys, "active_particle_target_index", rows=4)
|
||||||
|
|
||||||
col = row.column()
|
col = row.column()
|
||||||
sub = col.row()
|
sub = col.row()
|
||||||
@@ -760,7 +770,7 @@ class PARTICLE_PT_physics(ParticleButtonsPanel, Panel):
|
|||||||
row = layout.row()
|
row = layout.row()
|
||||||
if part.physics_type == 'KEYED':
|
if part.physics_type == 'KEYED':
|
||||||
col = row.column()
|
col = row.column()
|
||||||
#doesn't work yet
|
# doesn't work yet
|
||||||
#col.alert = key.valid
|
#col.alert = key.valid
|
||||||
col.prop(key, "object", text="")
|
col.prop(key, "object", text="")
|
||||||
col.prop(key, "system", text="System")
|
col.prop(key, "system", text="System")
|
||||||
@@ -770,7 +780,7 @@ class PARTICLE_PT_physics(ParticleButtonsPanel, Panel):
|
|||||||
col.prop(key, "duration")
|
col.prop(key, "duration")
|
||||||
elif part.physics_type == 'BOIDS':
|
elif part.physics_type == 'BOIDS':
|
||||||
sub = row.row()
|
sub = row.row()
|
||||||
#doesn't work yet
|
# doesn't work yet
|
||||||
#sub.alert = key.valid
|
#sub.alert = key.valid
|
||||||
sub.prop(key, "object", text="")
|
sub.prop(key, "object", text="")
|
||||||
sub.prop(key, "system", text="System")
|
sub.prop(key, "system", text="System")
|
||||||
@@ -778,7 +788,7 @@ class PARTICLE_PT_physics(ParticleButtonsPanel, Panel):
|
|||||||
layout.prop(key, "alliance", expand=True)
|
layout.prop(key, "alliance", expand=True)
|
||||||
elif part.physics_type == 'FLUID':
|
elif part.physics_type == 'FLUID':
|
||||||
sub = row.row()
|
sub = row.row()
|
||||||
#doesn't work yet
|
# doesn't work yet
|
||||||
#sub.alert = key.valid
|
#sub.alert = key.valid
|
||||||
sub.prop(key, "object", text="")
|
sub.prop(key, "object", text="")
|
||||||
sub.prop(key, "system", text="System")
|
sub.prop(key, "system", text="System")
|
||||||
@@ -831,7 +841,8 @@ class PARTICLE_PT_boidbrain(ParticleButtonsPanel, Panel):
|
|||||||
row.label(text="")
|
row.label(text="")
|
||||||
|
|
||||||
row = layout.row()
|
row = layout.row()
|
||||||
row.template_list("UI_UL_list", "particle_boids_rules", state, "rules", state, "active_boid_rule_index", rows=4)
|
row.template_list("UI_UL_list", "particle_boids_rules", state,
|
||||||
|
"rules", state, "active_boid_rule_index", rows=4)
|
||||||
|
|
||||||
col = row.column()
|
col = row.column()
|
||||||
sub = col.row()
|
sub = col.row()
|
||||||
@@ -848,7 +859,7 @@ class PARTICLE_PT_boidbrain(ParticleButtonsPanel, Panel):
|
|||||||
if rule:
|
if rule:
|
||||||
row = layout.row()
|
row = layout.row()
|
||||||
row.prop(rule, "name", text="")
|
row.prop(rule, "name", text="")
|
||||||
#somebody make nice icons for boids here please! -jahka
|
# somebody make nice icons for boids here please! -jahka
|
||||||
row.prop(rule, "use_in_air", icon='TRIA_UP', text="")
|
row.prop(rule, "use_in_air", icon='TRIA_UP', text="")
|
||||||
row.prop(rule, "use_on_land", icon='TRIA_DOWN', text="")
|
row.prop(rule, "use_on_land", icon='TRIA_DOWN', text="")
|
||||||
|
|
||||||
|
@@ -21,9 +21,9 @@ import bpy
|
|||||||
from bpy.types import Panel
|
from bpy.types import Panel
|
||||||
|
|
||||||
from bl_ui.properties_physics_common import (
|
from bl_ui.properties_physics_common import (
|
||||||
point_cache_ui,
|
point_cache_ui,
|
||||||
effector_weights_ui,
|
effector_weights_ui,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class PhysicButtonsPanel:
|
class PhysicButtonsPanel:
|
||||||
@@ -380,23 +380,23 @@ class PHYSICS_PT_smoke_display_settings(PhysicButtonsPanel, Panel):
|
|||||||
do_axis_slicing = (slice_method == 'AXIS_ALIGNED')
|
do_axis_slicing = (slice_method == 'AXIS_ALIGNED')
|
||||||
do_full_slicing = (axis_slice_method == 'FULL')
|
do_full_slicing = (axis_slice_method == 'FULL')
|
||||||
|
|
||||||
row = layout.row();
|
row = layout.row()
|
||||||
row.enabled = do_axis_slicing
|
row.enabled = do_axis_slicing
|
||||||
row.prop(domain, "axis_slice_method")
|
row.prop(domain, "axis_slice_method")
|
||||||
|
|
||||||
col = layout.column();
|
col = layout.column()
|
||||||
col.enabled = not do_full_slicing and do_axis_slicing
|
col.enabled = not do_full_slicing and do_axis_slicing
|
||||||
col.prop(domain, "slice_axis")
|
col.prop(domain, "slice_axis")
|
||||||
col.prop(domain, "slice_depth")
|
col.prop(domain, "slice_depth")
|
||||||
|
|
||||||
row = layout.row();
|
row = layout.row()
|
||||||
row.enabled = do_full_slicing or not do_axis_slicing
|
row.enabled = do_full_slicing or not do_axis_slicing
|
||||||
row.prop(domain, "slice_per_voxel")
|
row.prop(domain, "slice_per_voxel")
|
||||||
|
|
||||||
layout.separator()
|
layout.separator()
|
||||||
layout.label(text="Debug:")
|
layout.label(text="Debug:")
|
||||||
layout.prop(domain, "draw_velocity")
|
layout.prop(domain, "draw_velocity")
|
||||||
col = layout.column();
|
col = layout.column()
|
||||||
col.enabled = domain.draw_velocity
|
col.enabled = domain.draw_velocity
|
||||||
col.prop(domain, "vector_draw_type")
|
col.prop(domain, "vector_draw_type")
|
||||||
col.prop(domain, "vector_scale")
|
col.prop(domain, "vector_scale")
|
||||||
@@ -404,7 +404,7 @@ class PHYSICS_PT_smoke_display_settings(PhysicButtonsPanel, Panel):
|
|||||||
layout.separator()
|
layout.separator()
|
||||||
layout.label(text="Color Mapping:")
|
layout.label(text="Color Mapping:")
|
||||||
layout.prop(domain, "use_color_ramp")
|
layout.prop(domain, "use_color_ramp")
|
||||||
col = layout.column();
|
col = layout.column()
|
||||||
col.enabled = domain.use_color_ramp
|
col.enabled = domain.use_color_ramp
|
||||||
col.prop(domain, "coba_field")
|
col.prop(domain, "coba_field")
|
||||||
col.template_color_ramp(domain, "color_ramp", expand=True)
|
col.template_color_ramp(domain, "color_ramp", expand=True)
|
||||||
|
@@ -21,15 +21,15 @@ import bpy
|
|||||||
from bpy.types import Menu, Panel, UIList
|
from bpy.types import Menu, Panel, UIList
|
||||||
|
|
||||||
from bpy.types import (
|
from bpy.types import (
|
||||||
Brush,
|
Brush,
|
||||||
FreestyleLineStyle,
|
FreestyleLineStyle,
|
||||||
Lamp,
|
Lamp,
|
||||||
Material,
|
Material,
|
||||||
Object,
|
Object,
|
||||||
ParticleSettings,
|
ParticleSettings,
|
||||||
Texture,
|
Texture,
|
||||||
World,
|
World,
|
||||||
)
|
)
|
||||||
|
|
||||||
from rna_prop_ui import PropertyPanel
|
from rna_prop_ui import PropertyPanel
|
||||||
|
|
||||||
@@ -60,6 +60,7 @@ class TEXTURE_MT_envmap_specials(Menu):
|
|||||||
|
|
||||||
|
|
||||||
class TEXTURE_UL_texslots(UIList):
|
class TEXTURE_UL_texslots(UIList):
|
||||||
|
|
||||||
def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index):
|
def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index):
|
||||||
# assert(isinstance(item, bpy.types.MaterialTextureSlot)
|
# assert(isinstance(item, bpy.types.MaterialTextureSlot)
|
||||||
ma = data
|
ma = data
|
||||||
@@ -198,7 +199,8 @@ class TEXTURE_PT_context_texture(TextureButtonsPanel, Panel):
|
|||||||
if tex_collection:
|
if tex_collection:
|
||||||
row = layout.row()
|
row = layout.row()
|
||||||
|
|
||||||
row.template_list("TEXTURE_UL_texslots", "", idblock, "texture_slots", idblock, "active_texture_index", rows=2)
|
row.template_list("TEXTURE_UL_texslots", "", idblock, "texture_slots",
|
||||||
|
idblock, "active_texture_index", rows=2)
|
||||||
|
|
||||||
col = row.column(align=True)
|
col = row.column(align=True)
|
||||||
col.operator("texture.slot_move", text="", icon='TRIA_UP').type = 'UP'
|
col.operator("texture.slot_move", text="", icon='TRIA_UP').type = 'UP'
|
||||||
@@ -1210,12 +1212,22 @@ class TEXTURE_PT_influence(TextureSlotPanel, Panel):
|
|||||||
row = layout.row()
|
row = layout.row()
|
||||||
|
|
||||||
sub = row.row()
|
sub = row.row()
|
||||||
sub.active = (tex.use_map_normal or tex.use_map_warp) and not (tex.texture.type == 'IMAGE' and (tex.texture.use_normal_map or tex.texture.use_derivative_map))
|
sub.active = (
|
||||||
|
(tex.use_map_normal or tex.use_map_warp) and
|
||||||
|
not (tex.texture.type == 'IMAGE' and
|
||||||
|
(tex.texture.use_normal_map or tex.texture.use_derivative_map))
|
||||||
|
)
|
||||||
sub.prop(tex, "bump_method", text="Method")
|
sub.prop(tex, "bump_method", text="Method")
|
||||||
|
|
||||||
# the space setting is supported for: derivative-maps + bump-maps (DEFAULT,BEST_QUALITY), not for normal-maps
|
# the space setting is supported for: derivative-maps + bump-maps
|
||||||
|
# (DEFAULT,BEST_QUALITY), not for normal-maps
|
||||||
sub = row.row()
|
sub = row.row()
|
||||||
sub.active = (tex.use_map_normal or tex.use_map_warp) and not (tex.texture.type == 'IMAGE' and tex.texture.use_normal_map) and ((tex.bump_method in {'BUMP_LOW_QUALITY', 'BUMP_MEDIUM_QUALITY', 'BUMP_BEST_QUALITY'}) or (tex.texture.type == 'IMAGE' and tex.texture.use_derivative_map))
|
sub.active = (
|
||||||
|
(tex.use_map_normal or tex.use_map_warp) and
|
||||||
|
not (tex.texture.type == 'IMAGE' and tex.texture.use_normal_map) and
|
||||||
|
((tex.bump_method in {'BUMP_LOW_QUALITY', 'BUMP_MEDIUM_QUALITY', 'BUMP_BEST_QUALITY'}) or
|
||||||
|
(tex.texture.type == 'IMAGE' and tex.texture.use_derivative_map))
|
||||||
|
)
|
||||||
sub.prop(tex, "bump_objectspace", text="Space")
|
sub.prop(tex, "bump_objectspace", text="Space")
|
||||||
|
|
||||||
|
|
||||||
|
@@ -284,7 +284,8 @@ class VIEW3D_MT_transform_object(VIEW3D_MT_transform_base):
|
|||||||
layout.separator()
|
layout.separator()
|
||||||
|
|
||||||
layout.operator_context = 'EXEC_REGION_WIN'
|
layout.operator_context = 'EXEC_REGION_WIN'
|
||||||
layout.operator("transform.transform", text="Align to Transform Orientation").mode = 'ALIGN' # XXX see alignmenu() in edit.c of b2.4x to get this working
|
# XXX see alignmenu() in edit.c of b2.4x to get this working
|
||||||
|
layout.operator("transform.transform", text="Align to Transform Orientation").mode = 'ALIGN'
|
||||||
|
|
||||||
layout.separator()
|
layout.separator()
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user