minor cleanup

- remove / comment unused python vars
- replace mul_v3_fl(somevec, -1.0f); with negate_v3(somevec);
This commit is contained in:
Campbell Barton 2011-11-16 16:38:37 +00:00
parent 0566694f6e
commit 4d9766aacf
13 changed files with 35 additions and 64 deletions

@ -139,9 +139,9 @@ IF(PYTHONLIBSUNIX_FOUND)
# not used
# SET(PYTHON_BINARY ${PYTHON_EXECUTABLE} CACHE STRING "")
ENDIF()
MARK_AS_ADVANCED(
PYTHON_INCLUDE_DIR
PYTHON_LIBRARY
)
ENDIF()

@ -459,7 +459,7 @@ class CyclesWorld_PT_volume(CyclesButtonsPanel, Panel):
@classmethod
def poll(cls, context):
world = context.world
# world = context.world
return False # world and world.node_tree and CyclesButtonsPanel.poll(context)
def draw(self, context):
@ -493,7 +493,7 @@ class CyclesMaterial_PT_volume(CyclesButtonsPanel, Panel):
@classmethod
def poll(cls, context):
mat = context.material
# mat = context.material
return False # mat and mat.node_tree and CyclesButtonsPanel.poll(context)
def draw(self, context):
@ -562,7 +562,7 @@ class CyclesTexture_PT_context(CyclesButtonsPanel, Panel):
pin_id = space.pin_id
use_pin_id = space.use_pin_id
user = context.texture_user
node = context.texture_node
# node = context.texture_node
if not use_pin_id or not isinstance(pin_id, bpy.types.Texture):
pin_id = None
@ -638,7 +638,7 @@ class CyclesTexture_PT_mapping(CyclesButtonsPanel, Panel):
def draw(self, context):
layout = self.layout
tex = context.texture
# tex = context.texture
node = context.texture_node
mapping = node.texture_mapping
@ -664,15 +664,15 @@ class CyclesTexture_PT_colors(CyclesButtonsPanel, Panel):
@classmethod
def poll(cls, context):
tex = context.texture
node = context.texture_node
# tex = context.texture
# node = context.texture_node
return False
#return (node or (tex and tex.use_nodes)) and CyclesButtonsPanel.poll(context)
def draw(self, context):
layout = self.layout
tex = context.texture
# tex = context.texture
node = context.texture_node
mapping = node.color_mapping

@ -154,25 +154,23 @@ def resolve_ncase(path):
returning a string with the path if found else return the original path.
"""
import os
def _ncase_path_found(path):
if not path or os.path.exists(path):
if not path or _os.path.exists(path):
return path, True
# filename may be a directory or a file
filename = os.path.basename(path)
dirpath = os.path.dirname(path)
filename = _os.path.basename(path)
dirpath = _os.path.dirname(path)
suffix = path[:0] # "" but ensure byte/str match
if not filename: # dir ends with a slash?
if len(dirpath) < len(path):
suffix = path[:len(path) - len(dirpath)]
filename = os.path.basename(dirpath)
dirpath = os.path.dirname(dirpath)
filename = _os.path.basename(dirpath)
dirpath = _os.path.dirname(dirpath)
if not os.path.exists(dirpath):
if not _os.path.exists(dirpath):
if dirpath == path:
return path, False
@ -184,8 +182,8 @@ def resolve_ncase(path):
# at this point, the directory exists but not the file
# we are expecting 'dirpath' to be a directory, but it could be a file
if os.path.isdir(dirpath):
files = os.listdir(dirpath)
if _os.path.isdir(dirpath):
files = _os.listdir(dirpath)
else:
return path, False
@ -198,7 +196,7 @@ def resolve_ncase(path):
break
if f_iter_nocase:
return os.path.join(dirpath, f_iter_nocase) + suffix, True
return _os.path.join(dirpath, f_iter_nocase) + suffix, True
else:
# cant find the right one, just return the path as is.
return path, False
@ -216,8 +214,7 @@ def ensure_ext(filepath, ext, case_sensitive=False):
:arg case_sensitive: Check for matching case when comparing extensions.
:type case_sensitive: bool
"""
import os
fn_base, fn_ext = os.path.splitext(filepath)
fn_base, fn_ext = _os.path.splitext(filepath)
if fn_base and fn_ext:
if ((case_sensitive and ext == fn_ext) or
(ext.lower() == fn_ext.lower())):

@ -2,4 +2,3 @@ import bpy
bpy.context.object.data.sensor_width = 23.4
bpy.context.object.data.sensor_height = 15.6
bpy.context.object.data.sensor_fit = 'HORIZONTAL'

@ -86,13 +86,8 @@ class CLIP_OT_tracks_to_mesh(Operator):
@classmethod
def poll(cls, context):
if context.space_data.type != 'CLIP_EDITOR':
return False
sc = context.space_data
clip = sc.clip
return clip
return (sc.type == 'CLIP_EDITOR') and sc.clip
def execute(self, context):
sc = context.space_data

@ -147,7 +147,7 @@ class ProjectEdit(Operator):
# opengl buffer may fail, we can't help this, but best report it.
try:
ret = bpy.ops.paint.image_from_view()
bpy.ops.paint.image_from_view()
except RuntimeError as err:
self.report({'ERROR'}, str(err))
return {'CANCELLED'}

@ -106,7 +106,7 @@ def operator_path_is_undo(context, data_path):
# luckily we don't do this!
#
# When we cant find the data owner assume no undo is needed.
data_path_head, data_path_sep, data_path_tail = data_path.rpartition(".")
data_path_head = data_path.rpartition(".")[0]
if not data_path_head:
return False

@ -46,7 +46,6 @@ class PHYSICS_PT_dynamic_paint(PhysicButtonsPanel, Panel):
layout = self.layout
md = context.dynamic_paint
ob = context.object
layout.prop(md, "ui_type", expand=True)
@ -129,7 +128,6 @@ class PHYSICS_PT_dp_advanced_canvas(PhysicButtonsPanel, Panel):
canvas = context.dynamic_paint.canvas_settings
surface = canvas.canvas_surfaces.active
ob = context.object
surface_type = surface.surface_type
@ -370,8 +368,6 @@ class PHYSICS_PT_dp_cache(PhysicButtonsPanel, Panel):
md.canvas_settings.canvas_surfaces.active.is_cache_user)
def draw(self, context):
layout = self.layout
surface = context.dynamic_paint.canvas_settings.canvas_surfaces.active
cache = surface.point_cache
@ -442,7 +438,6 @@ class PHYSICS_PT_dp_brush_velocity(PhysicButtonsPanel, Panel):
layout = self.layout
brush = context.dynamic_paint.brush_settings
ob = context.object
split = layout.split()
@ -478,7 +473,6 @@ class PHYSICS_PT_dp_brush_wave(PhysicButtonsPanel, Panel):
layout = self.layout
brush = context.dynamic_paint.brush_settings
ob = context.object
layout.prop(brush, "wave_type")
if brush.wave_type != 'REFLECT':

@ -115,7 +115,6 @@ class CLIP_PT_tools_tracking(Panel):
def draw(self, context):
layout = self.layout
clip = context.space_data.clip
settings = clip.tracking.settings
row = layout.row(align=True)
@ -641,7 +640,6 @@ class CLIP_PT_tools_clip(Panel):
def draw(self, context):
layout = self.layout
clip = context.space_data.clip
layout.operator("clip.set_viewport_background")
@ -698,9 +696,6 @@ class CLIP_MT_proxy(Menu):
def draw(self, context):
layout = self.layout
sc = context.space_data
clip = sc.clip
layout.operator("clip.rebuild_proxy")
layout.operator("clip.delete_proxy")
@ -805,8 +800,6 @@ class CLIP_MT_select(Menu):
def draw(self, context):
layout = self.layout
sc = context.space_data
layout.operator("clip.select_border")
layout.operator("clip.select_circle")

@ -2276,12 +2276,6 @@ class VIEW3D_PT_background_image(Panel):
bl_label = "Background Images"
bl_options = {'DEFAULT_CLOSED'}
@classmethod
def poll(cls, context):
view = context.space_data
#~ bg = context.space_data.background_image
return (view)
def draw_header(self, context):
layout = self.layout
view = context.space_data
@ -2315,16 +2309,15 @@ class VIEW3D_PT_background_image(Panel):
row = box.row()
row.prop(bg, "source", expand=True)
hasbg = False
has_bg = False
if bg.source == 'IMAGE':
row = box.row()
row.template_ID(bg, "image", open="image.open")
if (bg.image):
box.template_image(bg, "image", bg.image_user, compact=True)
hasbg = True
has_bg = True
elif bg.source == 'MOVIE':
has_clip = False
box.prop(bg, 'use_camera_clip')
column = box.column()
@ -2335,14 +2328,14 @@ class VIEW3D_PT_background_image(Panel):
column.template_movieclip(bg, "clip", compact=True)
if bg.use_camera_clip or bg.clip:
hasbg = True
has_bg = True
column = box.column()
column.active = hasbg
column.active = has_bg
column.prop(bg.clip_user, "proxy_render_size", text="")
column.prop(bg.clip_user, "use_render_undistorted")
if hasbg:
if has_bg:
box.prop(bg, "opacity", slider=True)
if bg.view_axis != 'CAMERA':
box.prop(bg, "size")

@ -3235,7 +3235,7 @@ static int dynamicPaint_paintMesh(DynamicPaintSurface *surface,
/* Also cast a ray in opposite direction to make sure
* point is at least surrounded by two brush faces */
mul_v3_fl(ray_dir, -1.0f);
negate_v3(ray_dir);
hit.index = -1;
hit.dist = 9999;

@ -1911,7 +1911,7 @@ static void do_kink(ParticleKey *state, ParticleKey *par, float *par_rot, float
switch(type) {
case PART_KINK_CURL:
{
mul_v3_fl(par_vec, -1.f);
negate_v3(par_vec);
if(flat > 0.f) {
float proj[3];
@ -1977,7 +1977,7 @@ static void do_kink(ParticleKey *state, ParticleKey *par, float *par_rot, float
mul_qt_v3(par_rot, z_vec);
}
mul_v3_fl(par_vec, -1.f);
negate_v3(par_vec);
normalize_v3_v3(vec_one, par_vec);
inp_y=dot_v3v3(y_vec, vec_one);

@ -2679,7 +2679,7 @@ static float nr_signed_distance_to_plane(float *p, float radius, ParticleCollisi
}
if(pce->inv_nor == 1) {
mul_v3_fl(nor, -1.f);
negate_v3(nor);
d = -d;
}
@ -2799,7 +2799,7 @@ static void collision_point_on_surface(float p[3], ParticleCollisionElement *pce
normalize_v3(nor);
if(pce->inv_nor == 1)
mul_v3_fl(nor, -1.f);
negate_v3(nor);
madd_v3_v3v3fl(co, pce->x0, nor, col->radius);
madd_v3_v3fl(co, e1, pce->uv[0]);