misc uninteresting stuff (killing time at airport commit)

- pep8 updates
- RNA_TwoDFilterActuator --> RNA_Filter2DActuator
- minor changes to conolse namespace init.
This commit is contained in:
Campbell Barton 2010-05-03 16:00:42 +00:00
parent 0fdd003d9a
commit 245ab753f5
13 changed files with 46 additions and 39 deletions

@ -40,9 +40,9 @@ def get_console(console_id):
'''
from code import InteractiveConsole
try:
consoles = get_console.consoles
except:
consoles = getattr(get_console, "consoles", None)
if consoles is None:
consoles = get_console.consoles = {}
# clear all dead consoles, use text names as IDs
@ -53,16 +53,17 @@ def get_console(console_id):
del consoles[id]
'''
try:
console, stdout, stderr = consoles[console_id]
console_data = consoles.get(console_id)
if console_data:
console, stdout, stderr = console_data
# XXX, bug in python 3.1.2 ?
# seems there is no way to clear StringIO objects for writing, have to make new ones each time.
import io
stdout = io.StringIO()
stderr = io.StringIO()
except:
else:
namespace = {'__builtins__': __builtins__, 'bpy': bpy}
console = InteractiveConsole(namespace)

@ -28,7 +28,7 @@ class EditExternally(bpy.types.Operator):
bl_label = "Image Edit Externally"
bl_options = {'REGISTER'}
path = StringProperty(name="File Path", description="Path to an image file", maxlen= 1024, default= "")
path = StringProperty(name="File Path", description="Path to an image file", maxlen=1024, default="")
def _editor_guess(self, context):
import platform

@ -69,10 +69,10 @@ def applyVertexDirt(me, blur_iterations, blur_strength, clamp_dirt, clamp_clean,
# normalize the vector by dividing by the number of connected verts
tot_con = len(con[i])
if tot_con == 0:
continue
vec /= tot_con
# angle is the acos of the dot product between vert and connected verts normals

@ -303,7 +303,7 @@ class DATA_PT_texface(DataButtonsPanel):
ob = context.active_object
rd = context.scene.render
return (context.mode =='EDIT_MESH') and (rd.engine == 'BLENDER_GAME') and ob and ob.type == 'MESH'
return (context.mode == 'EDIT_MESH') and (rd.engine == 'BLENDER_GAME') and ob and ob.type == 'MESH'
def draw(self, context):
layout = self.layout

@ -389,7 +389,7 @@ class PARTICLE_PT_physics(ParticleButtonsPanel):
row.prop(part, "physics_type", expand=True)
else:
row.prop(part, "physics_type", text="")
if part.physics_type != 'NO':
row = layout.row()
col = row.column(align=True)

@ -49,12 +49,11 @@ def point_cache_ui(self, context, cache, enabled, particles, smoke):
layout.label(text=cache.info)
else:
layout.prop(cache, "name", text="File Name")
split = layout.split()
col = split.column(align=True)
if not particles:
col.enabled = enabled
col.prop(cache, "frame_start")
col.prop(cache, "frame_end")
@ -74,19 +73,18 @@ def point_cache_ui(self, context, cache, enabled, particles, smoke):
sub.prop(cache, "disk_cache")
col.label(text=cache.info)
layout.separator()
split = layout.split()
col = split.column()
if cache.baked == True:
col.operator("ptcache.free_bake", text="Free Bake")
else:
col.operator("ptcache.bake", text="Bake").bake = True
sub = col.row()
sub.enabled = (cache.frames_skipped or cache.outdated) and enabled
sub.operator("ptcache.bake", text="Calculate To Frame").bake = False
@ -94,8 +92,8 @@ def point_cache_ui(self, context, cache, enabled, particles, smoke):
sub = col.column()
sub.enabled = enabled
sub.operator("ptcache.bake_from_cache", text="Current Cache to Bake")
if wide_ui:
col = split.column()
col.operator("ptcache.bake_all", text="Bake All Dynamics").bake = True

@ -106,7 +106,6 @@ class RENDER_PT_layers(RenderButtonsPanel):
col.label(text="Mask Layers:")
col.prop(rl, "zmask_layers", text="")
layout.separator()
layout.label(text="Include:")

@ -47,6 +47,7 @@ class TEXTURE_MT_envmap_specials(bpy.types.Menu):
from properties_material import active_node_mat
def context_tex_datablock(context):
idblock = context.material
if idblock:
@ -71,7 +72,8 @@ class TextureButtonsPanel(bpy.types.Panel):
def poll(self, context):
tex = context.texture
if not tex or tex == None: return False
if not tex:
return False
engine = context.scene.render.engine
return (tex.type != 'NONE' or tex.use_nodes) and (engine in self.COMPAT_ENGINES)
@ -102,7 +104,7 @@ class TEXTURE_PT_context_texture(TextureButtonsPanel):
engine = context.scene.render.engine
if not hasattr(context, "texture_slot"):
return False
return ((context.material or context.world or context.lamp or context.brush or context.texture)
return ((context.material or context.world or context.lamp or context.brush or context.texture)
and (engine in self.COMPAT_ENGINES))
def draw(self, context):
@ -212,7 +214,7 @@ class TextureSlotPanel(TextureButtonsPanel):
def poll(self, context):
if not hasattr(context, "texture_slot"):
return False
engine = context.scene.render.engine
return TextureButtonsPanel.poll(self, context) and (engine in self.COMPAT_ENGINES)
@ -228,7 +230,7 @@ class TEXTURE_PT_mapping(TextureSlotPanel):
if not getattr(context, "texture_slot", None):
return False
engine = context.scene.render.engine
return (engine in self.COMPAT_ENGINES)
@ -277,7 +279,7 @@ class TEXTURE_PT_mapping(TextureSlotPanel):
row = layout.row()
row.active = tex.map_mode in ('FIXED', 'TILED')
row.prop(tex, "angle")
row = layout.row()
row.active = tex.map_mode in ('TILED', '3D')
row.column().prop(tex, "size")

@ -471,7 +471,7 @@ class IMAGE_PT_scope_sample(bpy.types.Panel):
def poll(self, context):
sima = context.space_data
return sima
return sima
def draw(self, context):
layout = self.layout

@ -85,6 +85,7 @@ class OUTLINER_MT_view(bpy.types.Menu):
layout.operator("screen.area_dupli")
layout.operator("screen.screen_full_area")
class OUTLINER_MT_search(bpy.types.Menu):
bl_label = "Search"
@ -98,6 +99,7 @@ class OUTLINER_MT_search(bpy.types.Menu):
col.prop(space, "match_case_sensitive")
col.prop(space, "match_complete")
class OUTLINER_MT_edit_datablocks(bpy.types.Menu):
bl_label = "Edit"
@ -118,7 +120,7 @@ class OUTLINER_MT_edit_datablocks(bpy.types.Menu):
classes = [
OUTLINER_HT_header,
OUTLINER_MT_view,
OUTLINER_MT_search,
OUTLINER_MT_search,
OUTLINER_MT_edit_datablocks]

@ -446,7 +446,7 @@ class SEQUENCER_PT_effect(SequencerButtonsPanel):
elif strip.type == 'TRANSFORM':
self.draw_panel_transform(strip)
elif strip.type == "MULTICAM":
layout.prop(strip, "multicam_source")
@ -518,7 +518,7 @@ class SEQUENCER_PT_input(SequencerButtonsPanel):
'CROSS', 'GAMMA_CROSS', 'MULTIPLY', 'OVER_DROP',
'PLUGIN',
'WIPE', 'GLOW', 'TRANSFORM', 'COLOR',
'MULTICAM','SPEED')
'MULTICAM', 'SPEED')
def draw_filename(self, context):
pass
@ -611,6 +611,7 @@ class SEQUENCER_PT_input_image(SEQUENCER_PT_input):
col = split.column()
col.prop(elem, "filename", text="") # strip.elements[0] could be a fallback
class SEQUENCER_PT_input_secondary(SEQUENCER_PT_input):
bl_label = "Strip Input"
@ -627,6 +628,7 @@ class SEQUENCER_PT_input_secondary(SEQUENCER_PT_input):
def draw_filename(self, context):
pass
class SEQUENCER_PT_sound(SequencerButtonsPanel):
bl_label = "Sound"

@ -92,7 +92,7 @@ KM_HIERARCHY = [
]),
('Property Editor', 'PROPERTIES', 'WINDOW', []), # align context menu
('Script', 'SCRIPTS_WINDOW', 'WINDOW', []),
('Text', 'TEXT_EDITOR', 'WINDOW', []),
('Console', 'CONSOLE', 'WINDOW', []),
@ -107,19 +107,22 @@ KM_HIERARCHY = [
('View3D Zoom Modal', 'EMPTY', 'WINDOW', []),
]
def _km_exists_in(km, export_keymaps):
for km2, kc in export_keymaps:
if km2.name == km.name:
return True
return False
# kc1 takes priority over kc2
def _merge_keymaps(kc1, kc2):
""" note: kc1 takes priority over kc2
"""
merged_keymaps = [(km, kc1) for km in kc1.keymaps]
if kc1 != kc2:
merged_keymaps.extend([(km, kc2) for km in kc2.keymaps if not _km_exists_in(km, merged_keymaps)])
return merged_keymaps
return merged_keymaps
class InputKeyMapPanel(bpy.types.Panel):

@ -65,7 +65,7 @@ static StructRNA* rna_Actuator_refine(struct PointerRNA *ptr)
case ACT_VISIBILITY:
return &RNA_VisibilityActuator;
case ACT_2DFILTER:
return &RNA_TwoDFilterActuator;
return &RNA_Filter2DActuator;
case ACT_PARENT:
return &RNA_ParentActuator;
case ACT_SHAPEACTION:
@ -969,7 +969,7 @@ static void rna_def_twodfilter_actuator(BlenderRNA *brna)
// {ACT_2DFILTER_NUMBER_OF_FILTERS, "", 0, "Do not use it. Sentinel", ""},
{0, NULL, 0, NULL, NULL}};
srna= RNA_def_struct(brna, "TwoDFilterActuator", "Actuator");
srna= RNA_def_struct(brna, "Filter2DActuator", "Actuator");
RNA_def_struct_ui_text(srna, "2D Filter Actuator", "Actuator to ..");
RNA_def_struct_sdna_from(srna, "bTwoDFilterActuator", "data");