- for BGE mouse and keyboard events use tuples rather then lists
- pep8 corrections
This commit is contained in:
parent
392e1da179
commit
4cf697de89
@ -27,6 +27,7 @@ script_paths = bpy.utils.script_paths()
|
||||
|
||||
_FAKE_STRUCT_SUBCLASS = True
|
||||
|
||||
|
||||
def _get_direct_attr(rna_type, attr):
|
||||
props = getattr(rna_type, attr)
|
||||
base = rna_type.base
|
||||
@ -45,6 +46,7 @@ def get_direct_properties(rna_type):
|
||||
def get_direct_functions(rna_type):
|
||||
return _get_direct_attr(rna_type, "functions")
|
||||
|
||||
|
||||
def rna_id_ignore(rna_id):
|
||||
if rna_id == "rna_type":
|
||||
return True
|
||||
@ -61,6 +63,7 @@ def rna_id_ignore(rna_id):
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
def range_str(val):
|
||||
if val < -10000000:
|
||||
return '-inf'
|
||||
@ -393,6 +396,7 @@ def GetInfoFunctionRNA(bl_rna, parent_id):
|
||||
def GetInfoOperatorRNA(bl_rna):
|
||||
return _GetInfoRNA(bl_rna, InfoOperatorRNA)
|
||||
|
||||
|
||||
def BuildRNAInfo():
|
||||
# Use for faster lookups
|
||||
# use rna_struct.identifier as the key for each dict
|
||||
@ -402,7 +406,6 @@ def BuildRNAInfo():
|
||||
rna_references_dict = {} # store a list of rna path strings that reference this type
|
||||
# rna_functions_dict = {} # store all functions directly in this type (not inherited)
|
||||
|
||||
|
||||
def full_rna_struct_path(rna_struct):
|
||||
'''
|
||||
Needed when referencing one struct from another
|
||||
|
@ -26,8 +26,8 @@ def align_objects(align_x, align_y, align_z, align_mode, relative_to):
|
||||
|
||||
cursor = bpy.context.scene.cursor_location
|
||||
|
||||
Left_Up_Front_SEL = [[],[],[]]
|
||||
Right_Down_Back_SEL = [[],[],[]]
|
||||
Left_Up_Front_SEL = [[], [], []]
|
||||
Right_Down_Back_SEL = [[], [], []]
|
||||
|
||||
flag_first = True
|
||||
|
||||
@ -43,13 +43,13 @@ def align_objects(align_x, align_y, align_z, align_mode, relative_to):
|
||||
|
||||
if obj == bpy.context.active_object:
|
||||
|
||||
center_active_x = ( Left_Up_Front[0] + Right_Down_Back[0] ) / 2
|
||||
center_active_y = ( Left_Up_Front[1] + Right_Down_Back[1] ) / 2
|
||||
center_active_z = ( Left_Up_Front[2] + Right_Down_Back[2] ) / 2
|
||||
center_active_x = (Left_Up_Front[0] + Right_Down_Back[0]) / 2
|
||||
center_active_y = (Left_Up_Front[1] + Right_Down_Back[1]) / 2
|
||||
center_active_z = (Left_Up_Front[2] + Right_Down_Back[2]) / 2
|
||||
|
||||
size_active_x = ( Right_Down_Back[0] - Left_Up_Front[0] ) / 2
|
||||
size_active_y = ( Right_Down_Back[1] - Left_Up_Front[1] ) / 2
|
||||
size_active_z = ( Left_Up_Front[2] - Right_Down_Back[2] ) / 2
|
||||
size_active_x = (Right_Down_Back[0] - Left_Up_Front[0]) / 2
|
||||
size_active_y = (Right_Down_Back[1] - Left_Up_Front[1]) / 2
|
||||
size_active_z = (Left_Up_Front[2] - Right_Down_Back[2]) / 2
|
||||
|
||||
# Selection Center
|
||||
|
||||
@ -85,9 +85,9 @@ def align_objects(align_x, align_y, align_z, align_mode, relative_to):
|
||||
if Right_Down_Back[2] < Right_Down_Back_SEL[2]:
|
||||
Right_Down_Back_SEL[2] = Right_Down_Back[2]
|
||||
|
||||
center_sel_x = ( Left_Up_Front_SEL[0] + Right_Down_Back_SEL[0] ) / 2
|
||||
center_sel_y = ( Left_Up_Front_SEL[1] + Right_Down_Back_SEL[1] ) / 2
|
||||
center_sel_z = ( Left_Up_Front_SEL[2] + Right_Down_Back_SEL[2] ) / 2
|
||||
center_sel_x = (Left_Up_Front_SEL[0] + Right_Down_Back_SEL[0]) / 2
|
||||
center_sel_y = (Left_Up_Front_SEL[1] + Right_Down_Back_SEL[1]) / 2
|
||||
center_sel_z = (Left_Up_Front_SEL[2] + Right_Down_Back_SEL[2]) / 2
|
||||
|
||||
# Main Loop
|
||||
|
||||
@ -100,9 +100,9 @@ def align_objects(align_x, align_y, align_z, align_mode, relative_to):
|
||||
Left_Up_Front = bb_world[1]
|
||||
Right_Down_Back = bb_world[7]
|
||||
|
||||
center_x = ( Left_Up_Front[0] + Right_Down_Back[0] ) / 2
|
||||
center_y = ( Left_Up_Front[1] + Right_Down_Back[1] ) / 2
|
||||
center_z = ( Left_Up_Front[2] + Right_Down_Back[2] ) / 2
|
||||
center_x = (Left_Up_Front[0] + Right_Down_Back[0]) / 2
|
||||
center_y = (Left_Up_Front[1] + Right_Down_Back[1]) / 2
|
||||
center_z = (Left_Up_Front[2] + Right_Down_Back[2]) / 2
|
||||
|
||||
positive_x = Right_Down_Back[0]
|
||||
positive_y = Right_Down_Back[1]
|
||||
@ -240,8 +240,7 @@ class AlignObjects(bpy.types.Operator):
|
||||
align_mode = bpy.props.EnumProperty(items=(
|
||||
('OPT_1', "Negative Sides", ""),
|
||||
('OPT_2', "Centers", ""),
|
||||
('OPT_3', "Positive Sides", "")
|
||||
),
|
||||
('OPT_3', "Positive Sides", "")),
|
||||
name="Align Mode:",
|
||||
description="",
|
||||
default='OPT_2')
|
||||
@ -250,8 +249,7 @@ class AlignObjects(bpy.types.Operator):
|
||||
('OPT_1', "Scene Origin", ""),
|
||||
('OPT_2', "3D Cursor", ""),
|
||||
('OPT_3', "Selection", ""),
|
||||
('OPT_4', "Active", "")
|
||||
),
|
||||
('OPT_4', "Active", "")),
|
||||
name="Relative To:",
|
||||
description="",
|
||||
default='OPT_4')
|
||||
|
@ -30,7 +30,7 @@ def randomize_selected(seed, loc, rot, scale, scale_even, scale_min):
|
||||
random.seed(seed)
|
||||
|
||||
def rand_vec(vec_range):
|
||||
return Vector([uniform(- val, val) for val in vec_range])
|
||||
return Vector([uniform(-val, val) for val in vec_range])
|
||||
|
||||
for obj in bpy.context.selected_objects:
|
||||
|
||||
|
@ -182,6 +182,7 @@ class AddPresetSunSky(AddPresetBase):
|
||||
|
||||
preset_subdir = "sunsky"
|
||||
|
||||
|
||||
class AddPresetInteraction(AddPresetBase):
|
||||
'''Add an Application Interaction Preset'''
|
||||
bl_idname = "wm.interaction_preset_add"
|
||||
|
@ -282,6 +282,7 @@ class DATA_PT_uv_texture(DataButtonsPanel):
|
||||
if lay:
|
||||
layout.prop(lay, "name")
|
||||
|
||||
|
||||
class DATA_PT_texface(DataButtonsPanel):
|
||||
bl_label = "Texture Face"
|
||||
|
||||
@ -289,8 +290,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 in ('MESH')
|
||||
return (context.mode =='EDIT_MESH') and (rd.engine == 'BLENDER_GAME') and ob and ob.type == 'MESH'
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
@ -912,6 +912,7 @@ class MATERIAL_PT_volume_integration(VolumeButtonsPanel):
|
||||
col.label()
|
||||
col.prop(vol, "depth_cutoff")
|
||||
|
||||
|
||||
class MATERIAL_PT_volume_options(VolumeButtonsPanel):
|
||||
bl_label = "Options"
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
|
||||
@ -938,7 +939,6 @@ class MATERIAL_PT_volume_options(VolumeButtonsPanel):
|
||||
row.prop(mat, "light_group_exclusive", text="Exclusive")
|
||||
|
||||
|
||||
|
||||
classes = [
|
||||
MATERIAL_PT_context_material,
|
||||
MATERIAL_PT_preview,
|
||||
|
@ -370,29 +370,29 @@ class RENDER_PT_output(RenderButtonsPanel):
|
||||
col.prop(rd, "quicktime_codec_type", text="Video Codec")
|
||||
col.prop(rd, "quicktime_codec_spatial_quality", text="Quality")
|
||||
|
||||
#Audio
|
||||
col.prop(rd,"quicktime_audiocodec_type", text="Audio Codec")
|
||||
# Audio
|
||||
col.prop(rd, "quicktime_audiocodec_type", text="Audio Codec")
|
||||
if rd.quicktime_audiocodec_type != 'No audio':
|
||||
split = layout.split()
|
||||
col = split.column()
|
||||
if rd.quicktime_audiocodec_type == 'LPCM':
|
||||
col.prop(rd,"quicktime_audio_bitdepth", text="")
|
||||
col.prop(rd, "quicktime_audio_bitdepth", text="")
|
||||
if wide_ui:
|
||||
col = split.column()
|
||||
col.prop(rd,"quicktime_audio_samplerate", text="")
|
||||
col.prop(rd, "quicktime_audio_samplerate", text="")
|
||||
|
||||
split = layout.split()
|
||||
col = split.column()
|
||||
if rd.quicktime_audiocodec_type == 'AAC':
|
||||
col.prop(rd,"quicktime_audio_bitrate")
|
||||
col.prop(rd, "quicktime_audio_bitrate")
|
||||
if wide_ui:
|
||||
subsplit = split.split()
|
||||
col = subsplit.column()
|
||||
if rd.quicktime_audiocodec_type == 'AAC':
|
||||
col.prop(rd,"quicktime_audio_codec_isvbr")
|
||||
col.prop(rd, "quicktime_audio_codec_isvbr")
|
||||
if wide_ui:
|
||||
col = subsplit.column()
|
||||
col.prop(rd,"quicktime_audio_resampling_hq")
|
||||
col.prop(rd, "quicktime_audio_resampling_hq")
|
||||
|
||||
|
||||
class RENDER_PT_encoding(RenderButtonsPanel):
|
||||
|
@ -409,6 +409,7 @@ class IMAGE_PT_view_histogram(bpy.types.Panel):
|
||||
layout.template_histogram(sima.scopes, "histogram")
|
||||
layout.prop(sima.scopes.histogram, "mode", icon_only=True)
|
||||
|
||||
|
||||
class IMAGE_PT_view_waveform(bpy.types.Panel):
|
||||
bl_space_type = 'IMAGE_EDITOR'
|
||||
bl_region_type = 'PREVIEW'
|
||||
@ -444,6 +445,7 @@ class IMAGE_PT_view_vectorscope(bpy.types.Panel):
|
||||
layout.template_vectorscope(sima, "scopes")
|
||||
layout.prop(sima.scopes, "vectorscope_alpha")
|
||||
|
||||
|
||||
class IMAGE_PT_sample_line(bpy.types.Panel):
|
||||
bl_space_type = 'IMAGE_EDITOR'
|
||||
bl_region_type = 'PREVIEW'
|
||||
@ -460,6 +462,7 @@ class IMAGE_PT_sample_line(bpy.types.Panel):
|
||||
layout.template_histogram(sima, "sample_histogram")
|
||||
layout.prop(sima.sample_histogram, "mode")
|
||||
|
||||
|
||||
class IMAGE_PT_scope_sample(bpy.types.Panel):
|
||||
bl_space_type = 'IMAGE_EDITOR'
|
||||
bl_region_type = 'PREVIEW'
|
||||
@ -479,6 +482,7 @@ class IMAGE_PT_scope_sample(bpy.types.Panel):
|
||||
row.active = not sima.scopes.use_full_resolution
|
||||
row.prop(sima.scopes, "accuracy")
|
||||
|
||||
|
||||
class IMAGE_PT_view_properties(bpy.types.Panel):
|
||||
bl_space_type = 'IMAGE_EDITOR'
|
||||
bl_region_type = 'UI'
|
||||
|
@ -749,7 +749,7 @@ class SEQUENCER_PT_view(SequencerButtonsPanel_Output):
|
||||
col.prop(st, "draw_safe_margin")
|
||||
if st.display_mode == 'WAVEFORM':
|
||||
col.prop(st, "separate_color_preview")
|
||||
col.prop(st, "proxy_render_size");
|
||||
col.prop(st, "proxy_render_size")
|
||||
|
||||
classes = [
|
||||
SEQUENCER_HT_header, # header/menu classes
|
||||
|
@ -66,6 +66,7 @@ def opengl_lamp_buttons(column, lamp):
|
||||
col.active = lamp.enabled
|
||||
col.prop(lamp, "direction", text="")
|
||||
|
||||
|
||||
class USERPREF_HT_header(bpy.types.Header):
|
||||
bl_space_type = 'USER_PREFERENCES'
|
||||
|
||||
@ -91,6 +92,7 @@ class USERPREF_HT_header(bpy.types.Header):
|
||||
elif userpref.active_section == 'THEMES':
|
||||
op = layout.operator("ui.reset_default_theme")
|
||||
|
||||
|
||||
class USERPREF_PT_tabs(bpy.types.Panel):
|
||||
bl_label = ""
|
||||
bl_space_type = 'USER_PREFERENCES'
|
||||
@ -1008,6 +1010,7 @@ class USERPREF_PT_file(bpy.types.Panel):
|
||||
|
||||
from space_userpref_keymap import InputKeyMapPanel
|
||||
|
||||
|
||||
class USERPREF_PT_input(InputKeyMapPanel):
|
||||
bl_space_type = 'USER_PREFERENCES'
|
||||
bl_label = "Input"
|
||||
@ -1409,7 +1412,6 @@ class WM_OT_addon_links(bpy.types.Operator):
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
|
||||
classes = [
|
||||
USERPREF_HT_header,
|
||||
USERPREF_PT_tabs,
|
||||
@ -1428,7 +1430,7 @@ classes = [
|
||||
WM_OT_addon_disable,
|
||||
WM_OT_addon_install,
|
||||
WM_OT_addon_expand,
|
||||
WM_OT_addon_links ]
|
||||
WM_OT_addon_links]
|
||||
|
||||
|
||||
def register():
|
||||
|
@ -121,6 +121,7 @@ def _merge_keymaps(kc1, kc2):
|
||||
|
||||
return merged_keymaps
|
||||
|
||||
|
||||
class InputKeyMapPanel(bpy.types.Panel):
|
||||
bl_space_type = 'USER_PREFERENCES'
|
||||
bl_label = "Input"
|
||||
@ -315,7 +316,6 @@ class InputKeyMapPanel(bpy.types.Panel):
|
||||
self.draw_km(display_keymaps, kc, kmm, None, layout, level + 1)
|
||||
layout.set_context_pointer("keymap", km)
|
||||
|
||||
|
||||
def draw_filtered(self, display_keymaps, filter, layout):
|
||||
for km, kc in display_keymaps:
|
||||
km = km.active()
|
||||
@ -559,6 +559,8 @@ class WM_OT_keyconfig_import(bpy.types.Operator):
|
||||
return {'RUNNING_MODAL'}
|
||||
|
||||
# This operator is also used by interaction presets saving - AddPresetBase
|
||||
|
||||
|
||||
class WM_OT_keyconfig_export(bpy.types.Operator):
|
||||
"Export key configuration to a python script"
|
||||
bl_idname = "wm.keyconfig_export"
|
||||
@ -604,6 +606,7 @@ class WM_OT_keyconfig_export(bpy.types.Operator):
|
||||
# This will create a final list of keymaps that can be used as a 'diff' against
|
||||
# the default blender keyconfig, recreating the current setup from a fresh blender
|
||||
# without needing to export keymaps which haven't been edited.
|
||||
|
||||
class FakeKeyConfig():
|
||||
keymaps = []
|
||||
edited_kc = FakeKeyConfig()
|
||||
|
@ -102,9 +102,9 @@ PyObject* SCA_PythonKeyboard::pyattr_get_events(void *self_v, const KX_PYATTRIBU
|
||||
|
||||
if (inevent.m_status != SCA_InputEvent::KX_NO_INPUTSTATUS)
|
||||
{
|
||||
PyObject* keypair = PyList_New(2);
|
||||
PyList_SET_ITEM(keypair, 0, PyLong_FromSsize_t(i));
|
||||
PyList_SET_ITEM(keypair, 1, PyLong_FromSsize_t(inevent.m_status));
|
||||
PyObject* keypair = PyTuple_New(2);
|
||||
PyTuple_SET_ITEM(keypair, 0, PyLong_FromSsize_t(i));
|
||||
PyTuple_SET_ITEM(keypair, 1, PyLong_FromSsize_t(inevent.m_status));
|
||||
PyList_Append(resultlist, keypair);
|
||||
}
|
||||
}
|
||||
|
@ -107,9 +107,9 @@ PyObject* SCA_PythonMouse::pyattr_get_events(void *self_v, const KX_PYATTRIBUTE_
|
||||
|
||||
if (inevent.m_status != SCA_InputEvent::KX_NO_INPUTSTATUS)
|
||||
{
|
||||
PyObject* keypair = PyList_New(2);
|
||||
PyList_SET_ITEM(keypair, 0, PyLong_FromSsize_t(i));
|
||||
PyList_SET_ITEM(keypair, 1, PyLong_FromSsize_t(inevent.m_status));
|
||||
PyObject* keypair = PyTuple_New(2);
|
||||
PyTuple_SET_ITEM(keypair, 0, PyLong_FromSsize_t(i));
|
||||
PyTuple_SET_ITEM(keypair, 1, PyLong_FromSsize_t(inevent.m_status));
|
||||
PyList_Append(resultlist, keypair);
|
||||
}
|
||||
}
|
||||
@ -123,13 +123,12 @@ PyObject* SCA_PythonMouse::pyattr_get_position(void *self_v, const KX_PYATTRIBUT
|
||||
const SCA_InputEvent & xevent = self->m_mouse->GetEventValue(SCA_IInputDevice::KX_MOUSEX);
|
||||
const SCA_InputEvent & yevent = self->m_mouse->GetEventValue(SCA_IInputDevice::KX_MOUSEY);
|
||||
|
||||
PyObject* resultlist = PyList_New(2);
|
||||
PyObject* ret = PyTuple_New(2);
|
||||
|
||||
PyList_SET_ITEM(resultlist, 0, PyFloat_FromDouble(float(xevent.m_eventval)/self->m_canvas->GetWidth()));
|
||||
PyTuple_SET_ITEM(ret, 0, PyFloat_FromDouble(float(xevent.m_eventval)/self->m_canvas->GetWidth()));
|
||||
PyTuple_SET_ITEM(ret, 1, PyFloat_FromDouble(float(yevent.m_eventval)/self->m_canvas->GetHeight()));
|
||||
|
||||
PyList_SET_ITEM(resultlist, 1, PyFloat_FromDouble(float(yevent.m_eventval)/self->m_canvas->GetHeight()));
|
||||
|
||||
return resultlist;
|
||||
return ret;
|
||||
}
|
||||
|
||||
int SCA_PythonMouse::pyattr_set_position(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
|
||||
|
Loading…
x
Reference in New Issue
Block a user