Merge branch 'master' into blender2.8
Conflicts: intern/cycles/blender/addon/properties.py
This commit is contained in:
@@ -198,3 +198,53 @@ class MeshSelectPrev(Operator):
|
||||
bmesh.update_edit_mesh(me, False)
|
||||
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
# XXX This is hackish (going forth and back from Object mode...), to be redone once we have proper support of
|
||||
# custom normals in BMesh/edit mode.
|
||||
class MehsSetNormalsFromFaces(Operator):
|
||||
"""Set the custom vertex normals from the selected faces ones"""
|
||||
bl_idname = "mesh.set_normals_from_faces"
|
||||
bl_label = "Set Normals From Faces"
|
||||
bl_options = {'REGISTER', 'UNDO'}
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
return (context.mode == 'EDIT_MESH' and context.edit_object.data.polygons)
|
||||
|
||||
def execute(self, context):
|
||||
import mathutils
|
||||
|
||||
bpy.ops.object.mode_set(mode='OBJECT')
|
||||
obj = context.active_object
|
||||
me = obj.data
|
||||
|
||||
v2nors = {}
|
||||
for p in me.polygons:
|
||||
if not p.select:
|
||||
continue
|
||||
for lidx, vidx in zip(p.loop_indices, p.vertices):
|
||||
assert(me.loops[lidx].vertex_index == vidx)
|
||||
v2nors.setdefault(vidx, []).append(p.normal)
|
||||
|
||||
for nors in v2nors.values():
|
||||
nors[:] = [sum(nors, mathutils.Vector((0, 0, 0))).normalized()]
|
||||
|
||||
if not me.has_custom_normals:
|
||||
me.create_normals_split()
|
||||
me.calc_normals_split()
|
||||
|
||||
normals = []
|
||||
for l in me.loops:
|
||||
nor = v2nors.get(l.vertex_index, [None])[0]
|
||||
if nor is None:
|
||||
nor = l.normal
|
||||
normals.append(nor.to_tuple())
|
||||
|
||||
me.normals_split_custom_set(normals)
|
||||
|
||||
me.free_normals_split()
|
||||
bpy.ops.object.mode_set(mode='EDIT')
|
||||
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
@@ -2163,3 +2163,32 @@ class WM_OT_addon_expand(Operator):
|
||||
info["show_expanded"] = not info["show_expanded"]
|
||||
|
||||
return {'FINISHED'}
|
||||
|
||||
class WM_OT_addon_userpref_show(Operator):
|
||||
"Show add-on user preferences"
|
||||
bl_idname = "wm.addon_userpref_show"
|
||||
bl_label = ""
|
||||
bl_options = {'INTERNAL'}
|
||||
|
||||
module = StringProperty(
|
||||
name="Module",
|
||||
description="Module name of the add-on to expand",
|
||||
)
|
||||
|
||||
def execute(self, context):
|
||||
import addon_utils
|
||||
|
||||
module_name = self.module
|
||||
|
||||
modules = addon_utils.modules(refresh=False)
|
||||
mod = addon_utils.addons_fake_modules.get(module_name)
|
||||
if mod is not None:
|
||||
info = addon_utils.module_bl_info(mod)
|
||||
info["show_expanded"] = True
|
||||
|
||||
bpy.context.user_preferences.active_section = 'ADDONS'
|
||||
context.window_manager.addon_filter = 'All'
|
||||
context.window_manager.addon_search = info["name"]
|
||||
bpy.ops.screen.userpref_show('INVOKE_DEFAULT')
|
||||
|
||||
return {'FINISHED'}
|
||||
|
||||
@@ -205,30 +205,60 @@ class PHYSICS_PT_rigid_body_constraint(PHYSICS_PT_rigidbody_constraint_panel, Pa
|
||||
|
||||
row = col.row(align=True)
|
||||
sub = row.row(align=True)
|
||||
sub.scale_x = 0.1
|
||||
sub.prop(rbc, "use_spring_x", toggle=True, text="X")
|
||||
sub.scale_x = 0.5
|
||||
sub.prop(rbc, "use_spring_x", toggle=True, text="X Axis")
|
||||
sub = row.row(align=True)
|
||||
sub.active = rbc.use_spring_x
|
||||
sub.prop(rbc, "spring_stiffness_x", text="Stiffness")
|
||||
sub.prop(rbc, "spring_damping_x")
|
||||
sub.prop(rbc, "spring_damping_x", text="Damping")
|
||||
|
||||
row = col.row(align=True)
|
||||
sub = row.row(align=True)
|
||||
sub.scale_x = 0.1
|
||||
sub.prop(rbc, "use_spring_y", toggle=True, text="Y")
|
||||
sub.scale_x = 0.5
|
||||
sub.prop(rbc, "use_spring_y", toggle=True, text="Y Axis")
|
||||
sub = row.row(align=True)
|
||||
sub.active = rbc.use_spring_y
|
||||
sub.prop(rbc, "spring_stiffness_y", text="Stiffness")
|
||||
sub.prop(rbc, "spring_damping_y")
|
||||
sub.prop(rbc, "spring_damping_y", text="Damping")
|
||||
|
||||
row = col.row(align=True)
|
||||
sub = row.row(align=True)
|
||||
sub.scale_x = 0.1
|
||||
sub.prop(rbc, "use_spring_z", toggle=True, text="Z")
|
||||
sub.scale_x = 0.5
|
||||
sub.prop(rbc, "use_spring_z", toggle=True, text="Z Axis")
|
||||
sub = row.row(align=True)
|
||||
sub.active = rbc.use_spring_z
|
||||
sub.prop(rbc, "spring_stiffness_z", text="Stiffness")
|
||||
sub.prop(rbc, "spring_damping_z")
|
||||
sub.prop(rbc, "spring_damping_z", text="Damping")
|
||||
|
||||
col = layout.column(align=True)
|
||||
|
||||
row = col.row(align=True)
|
||||
sub = row.row(align=True)
|
||||
sub.scale_x = 0.5
|
||||
sub.prop(rbc, "use_spring_ang_x", toggle=True, text="X Angle")
|
||||
sub = row.row(align=True)
|
||||
sub.active = rbc.use_spring_ang_x
|
||||
sub.prop(rbc, "spring_stiffness_ang_x", text="Stiffness")
|
||||
sub.prop(rbc, "spring_damping_ang_x", text="Damping")
|
||||
|
||||
row = col.row(align=True)
|
||||
sub = row.row(align=True)
|
||||
sub.scale_x = 0.5
|
||||
sub.prop(rbc, "use_spring_ang_y", toggle=True, text="Y Angle")
|
||||
sub = row.row(align=True)
|
||||
sub.active = rbc.use_spring_ang_y
|
||||
sub.prop(rbc, "spring_stiffness_ang_y", text="Stiffness")
|
||||
sub.prop(rbc, "spring_damping_ang_y", text="Damping")
|
||||
|
||||
row = col.row(align=True)
|
||||
sub = row.row(align=True)
|
||||
sub.scale_x = 0.5
|
||||
sub.prop(rbc, "use_spring_ang_z", toggle=True, text="Z Angle")
|
||||
sub = row.row(align=True)
|
||||
sub.active = rbc.use_spring_ang_z
|
||||
sub.prop(rbc, "spring_stiffness_ang_z", text="Stiffness")
|
||||
sub.prop(rbc, "spring_damping_ang_z", text="Damping")
|
||||
|
||||
|
||||
if __name__ == "__main__": # only for live edit.
|
||||
bpy.utils.register_module(__name__)
|
||||
|
||||
@@ -428,13 +428,6 @@ class USERPREF_PT_system(Panel):
|
||||
|
||||
col.separator()
|
||||
|
||||
if hasattr(system, "compute_device_type"):
|
||||
col.label(text="Compute Device:")
|
||||
col.row().prop(system, "compute_device_type", expand=True)
|
||||
sub = col.row()
|
||||
sub.active = system.compute_device_type != 'CPU'
|
||||
sub.prop(system, "compute_device", text="")
|
||||
|
||||
if hasattr(system, "opensubdiv_compute_type"):
|
||||
col.label(text="OpenSubdiv compute:")
|
||||
col.row().prop(system, "opensubdiv_compute_type", text="")
|
||||
|
||||
@@ -431,6 +431,7 @@ class VIEW3D_PT_tools_shading(View3DPanel, Panel):
|
||||
col.label(text="Normals:")
|
||||
col.operator("mesh.normals_make_consistent", text="Recalculate")
|
||||
col.operator("mesh.flip_normals", text="Flip Direction")
|
||||
col.operator("mesh.set_normals_from_faces", text="Set From Faces")
|
||||
|
||||
|
||||
class VIEW3D_PT_tools_uvs(View3DPanel, Panel):
|
||||
|
||||
Reference in New Issue
Block a user