Merged changes in the trunk up to revision 54802.
This commit is contained in:
@@ -109,7 +109,8 @@ class BakeToKeyframes(Operator):
|
||||
objects = []
|
||||
scene = context.scene
|
||||
frame_orig = scene.frame_current
|
||||
frames = list(range(self.frame_start, self.frame_end + 1, self.step))
|
||||
frames_step = range(self.frame_start, self.frame_end + 1, self.step)
|
||||
frames_full = range(self.frame_start, self.frame_end + 1)
|
||||
|
||||
# filter objects selection
|
||||
for obj in context.selected_objects:
|
||||
@@ -120,16 +121,17 @@ class BakeToKeyframes(Operator):
|
||||
|
||||
if objects:
|
||||
# store transformation data
|
||||
for f in list(range(self.frame_start, self.frame_end + 1)):
|
||||
# need to start at scene start frame so simulation is run from the beginning
|
||||
for f in frames_full:
|
||||
scene.frame_set(f)
|
||||
if f in frames:
|
||||
if f in frames_step:
|
||||
mat = {}
|
||||
for i, obj in enumerate(objects):
|
||||
mat[i] = obj.matrix_world.copy()
|
||||
bake.append(mat)
|
||||
|
||||
# apply transformations as keyframes
|
||||
for i, f in enumerate(frames):
|
||||
for i, f in enumerate(frames_step):
|
||||
scene.frame_set(f)
|
||||
obj_prev = objects[0]
|
||||
for j, obj in enumerate(objects):
|
||||
@@ -144,7 +146,7 @@ class BakeToKeyframes(Operator):
|
||||
# this is a little roundabout but there's no better way right now
|
||||
aa = mat.to_quaternion().to_axis_angle()
|
||||
obj.rotation_axis_angle = (aa[1], ) + aa[0][:]
|
||||
else: # euler
|
||||
else: # euler
|
||||
# make sure euler rotation is compatible to previous frame
|
||||
obj.rotation_euler = mat.to_euler(rot_mode, obj_prev.rotation_euler)
|
||||
|
||||
@@ -190,8 +192,7 @@ class BakeToKeyframes(Operator):
|
||||
|
||||
|
||||
class ConnectRigidBodies(Operator):
|
||||
"""Create rigid body constraints between """ \
|
||||
"""selected and active rigid bodies"""
|
||||
'''Create rigid body constraints between selected rigid bodies'''
|
||||
bl_idname = "rigidbody.connect"
|
||||
bl_label = "Connect Rigid Bodies"
|
||||
bl_options = {'REGISTER', 'UNDO'}
|
||||
@@ -212,40 +213,72 @@ class ConnectRigidBodies(Operator):
|
||||
('SELECTED', "Selected", "Pivot location is at the selected object position")),
|
||||
default='CENTER',)
|
||||
|
||||
connection_pattern = EnumProperty(
|
||||
name="Connection Pattern",
|
||||
description="Pattern used to connect objects",
|
||||
items=(('SELECTED_TO_ACTIVE', "Selected to Active", "Connects selected objects to the active object"),
|
||||
('CHAIN_DISTANCE', "Chain by Distance", "Connects objects as a chain based on distance, starting at the active object")),
|
||||
default='SELECTED_TO_ACTIVE',)
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
obj = context.object
|
||||
return (obj and obj.rigid_body)
|
||||
|
||||
def execute(self, context):
|
||||
def _add_constraint(self, context, object1, object2):
|
||||
if object1 == object2:
|
||||
return
|
||||
|
||||
if self.pivot_type == 'ACTIVE':
|
||||
loc = object1.location
|
||||
elif self.pivot_type == 'SELECTED':
|
||||
loc = object2.location
|
||||
else:
|
||||
loc = (object1.location + object2.location) / 2.0
|
||||
|
||||
ob = bpy.data.objects.new("Constraint", object_data=None)
|
||||
ob.location = loc
|
||||
context.scene.objects.link(ob)
|
||||
context.scene.objects.active = ob
|
||||
ob.select = True
|
||||
|
||||
bpy.ops.rigidbody.constraint_add()
|
||||
con_obj = context.active_object
|
||||
con_obj.empty_draw_type = 'ARROWS'
|
||||
con = con_obj.rigid_body_constraint
|
||||
con.type = self.con_type
|
||||
|
||||
con.object1 = object1
|
||||
con.object2 = object2
|
||||
|
||||
def execute(self, context):
|
||||
scene = context.scene
|
||||
objects = context.selected_objects
|
||||
obj_act = context.active_object
|
||||
change = False
|
||||
|
||||
for obj in objects:
|
||||
if obj == obj_act:
|
||||
continue
|
||||
if self.pivot_type == 'ACTIVE':
|
||||
loc = obj_act.location
|
||||
elif self.pivot_type == 'SELECTED':
|
||||
loc = obj.location
|
||||
else:
|
||||
loc = (obj_act.location + obj.location) / 2.0
|
||||
# TODO: use bpy.data.objects.new(...)
|
||||
bpy.ops.object.add(type='EMPTY',
|
||||
view_align=False,
|
||||
enter_editmode=False,
|
||||
location=loc)
|
||||
bpy.ops.rigidbody.constraint_add()
|
||||
con_obj = context.active_object
|
||||
con_obj.empty_draw_type = 'ARROWS'
|
||||
con = con_obj.rigid_body_constraint
|
||||
con.type = self.con_type
|
||||
con.object1 = obj_act
|
||||
con.object2 = obj
|
||||
change = True
|
||||
if self.connection_pattern == 'CHAIN_DISTANCE':
|
||||
objs_sorted = [obj_act]
|
||||
objects_tmp = context.selected_objects
|
||||
if obj_act.select:
|
||||
objects_tmp.remove(obj_act)
|
||||
objects_tmp.sort(key=lambda o: (obj_act.location - o.location).length)
|
||||
last_obj = obj_act
|
||||
|
||||
while (len(objects_tmp)):
|
||||
objects_tmp.sort(key=lambda o: (last_obj.location - o.location).length)
|
||||
objs_sorted.append(objects_tmp[0])
|
||||
last_obj = objects_tmp[0]
|
||||
objects_tmp.remove(objects_tmp[0])
|
||||
|
||||
for i in range(1, len(objs_sorted)):
|
||||
self._add_constraint(context, objs_sorted[i-1], objs_sorted[i])
|
||||
change = True
|
||||
|
||||
else: # SELECTED_TO_ACTIVE
|
||||
for obj in objects:
|
||||
self._add_constraint(context, obj_act, obj)
|
||||
change = True;
|
||||
|
||||
if change:
|
||||
# restore selection
|
||||
|
||||
@@ -138,6 +138,7 @@ def unregister():
|
||||
|
||||
|
||||
# Define a default UIList, when a list does not need any custom drawing...
|
||||
# Keep in sync with its #defined name in UI_interface.h
|
||||
class UI_UL_list(bpy.types.UIList):
|
||||
pass
|
||||
|
||||
|
||||
@@ -184,7 +184,8 @@ class DATA_PT_pose_library(ArmatureButtonsPanel, Panel):
|
||||
if poselib:
|
||||
# list of poses in pose library
|
||||
row = layout.row()
|
||||
row.template_list("UI_UL_list", "", poselib, "pose_markers", poselib.pose_markers, "active_index", rows=5)
|
||||
row.template_list("UI_UL_list", "pose_markers", poselib, "pose_markers",
|
||||
poselib.pose_markers, "active_index", rows=5)
|
||||
|
||||
# column of operators for active pose
|
||||
# - goes beside list
|
||||
|
||||
@@ -124,20 +124,17 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
|
||||
split.prop(md, "width")
|
||||
split.prop(md, "use_only_vertices")
|
||||
|
||||
# -- new modifier only, this may be reverted in favor of 2.62 mod.
|
||||
'''
|
||||
split = layout.split()
|
||||
split.prop(md, "use_even_offset")
|
||||
split.prop(md, "use_distance_offset")
|
||||
'''
|
||||
# -- end
|
||||
layout.prop(md, "segments")
|
||||
|
||||
layout.label(text="Limit Method:")
|
||||
layout.row().prop(md, "limit_method", expand=True)
|
||||
if md.limit_method == 'ANGLE':
|
||||
layout.prop(md, "angle_limit")
|
||||
elif md.limit_method == 'WEIGHT':
|
||||
layout.row().prop(md, "edge_weight_method", expand=True)
|
||||
elif md.limit_method == 'VGROUP':
|
||||
layout.label(text="Vertex Group:")
|
||||
layout.prop_search(md, "vertex_group", ob, "vertex_groups", text="")
|
||||
# elif md.limit_method == 'WEIGHT':
|
||||
# layout.row().prop(md, "edge_weight_method", expand=True)
|
||||
|
||||
def BOOLEAN(self, layout, ob, md):
|
||||
split = layout.split()
|
||||
|
||||
@@ -84,8 +84,6 @@ class MATERIAL_UL_matslots(UIList):
|
||||
layout.label(text=iface_("Node %s") % manode.name, translate=False, icon_value=layout.icon(manode))
|
||||
elif ma.use_nodes:
|
||||
layout.label(text="Node <none>")
|
||||
else:
|
||||
layout.label(text="")
|
||||
elif self.layout_type in {'GRID'}:
|
||||
layout.alignment = 'CENTER'
|
||||
layout.label(text="", icon_value=icon)
|
||||
@@ -566,7 +564,7 @@ class MATERIAL_PT_halo(MaterialButtonsPanel, Panel):
|
||||
row.prop(halo, toggle, text="")
|
||||
sub = row.column()
|
||||
sub.active = getattr(halo, toggle)
|
||||
sub.prop(halo, number, text=name)
|
||||
sub.prop(halo, number, text=name, translate=False)
|
||||
if not color == "":
|
||||
sub.prop(mat, color, text="")
|
||||
|
||||
@@ -593,9 +591,9 @@ class MATERIAL_PT_halo(MaterialButtonsPanel, Panel):
|
||||
col.prop(halo, "use_soft")
|
||||
|
||||
col = split.column()
|
||||
number_but(col, "use_ring", "ring_count", "Rings", "mirror_color")
|
||||
number_but(col, "use_lines", "line_count", "Lines", "specular_color")
|
||||
number_but(col, "use_star", "star_tip_count", "Star tips", "")
|
||||
number_but(col, "use_ring", "ring_count", iface_("Rings"), "mirror_color")
|
||||
number_but(col, "use_lines", "line_count", iface_("Lines"), "specular_color")
|
||||
number_but(col, "use_star", "star_tip_count", iface_("Star Tips"), "")
|
||||
|
||||
|
||||
class MATERIAL_PT_flare(MaterialButtonsPanel, Panel):
|
||||
|
||||
@@ -97,7 +97,8 @@ class PARTICLE_PT_context_particles(ParticleButtonsPanel, Panel):
|
||||
if ob:
|
||||
row = layout.row()
|
||||
|
||||
row.template_list("UI_UL_list", "", ob, "particle_systems", ob.particle_systems, "active_index", rows=2)
|
||||
row.template_list("UI_UL_list", "particle_systems", ob, "particle_systems",
|
||||
ob.particle_systems, "active_index", rows=2)
|
||||
|
||||
col = row.column(align=True)
|
||||
col.operator("object.particle_system_add", icon='ZOOMIN', text="")
|
||||
@@ -637,7 +638,7 @@ class PARTICLE_PT_physics(ParticleButtonsPanel, Panel):
|
||||
layout.label(text="Fluid interaction:")
|
||||
|
||||
row = layout.row()
|
||||
row.template_list("UI_UL_list", "", psys, "targets", psys, "active_particle_target_index")
|
||||
row.template_list("UI_UL_list", "particle_targets", psys, "targets", psys, "active_particle_target_index")
|
||||
|
||||
col = row.column()
|
||||
sub = col.row()
|
||||
@@ -703,7 +704,8 @@ class PARTICLE_PT_boidbrain(ParticleButtonsPanel, Panel):
|
||||
|
||||
# Currently boids can only use the first state so these are commented out for now.
|
||||
#row = layout.row()
|
||||
#row.template_list("UI_UL_list", "", boids, "states", boids, "active_boid_state_index", compact="True")
|
||||
#row.template_list("UI_UL_list", "particle_boids", boids, "states",
|
||||
# boids, "active_boid_state_index", compact="True")
|
||||
#col = row.row()
|
||||
#sub = col.row(align=True)
|
||||
#sub.operator("boid.state_add", icon='ZOOMIN', text="")
|
||||
@@ -724,7 +726,7 @@ class PARTICLE_PT_boidbrain(ParticleButtonsPanel, Panel):
|
||||
row.label(text="")
|
||||
|
||||
row = layout.row()
|
||||
row.template_list("UI_UL_list", "", state, "rules", state, "active_boid_rule_index")
|
||||
row.template_list("UI_UL_list", "particle_boids_rules", state, "rules", state, "active_boid_rule_index")
|
||||
|
||||
col = row.column()
|
||||
sub = col.row()
|
||||
@@ -887,7 +889,8 @@ class PARTICLE_PT_render(ParticleButtonsPanel, Panel):
|
||||
|
||||
if part.use_group_count and not part.use_whole_group:
|
||||
row = layout.row()
|
||||
row.template_list("UI_UL_list", "", part, "dupli_weights", part, "active_dupliweight_index")
|
||||
row.template_list("UI_UL_list", "particle_dupli_weights", part, "dupli_weights",
|
||||
part, "active_dupliweight_index")
|
||||
|
||||
col = row.column()
|
||||
sub = col.row()
|
||||
|
||||
@@ -108,7 +108,8 @@ def point_cache_ui(self, context, cache, enabled, cachetype):
|
||||
|
||||
if not cachetype == 'RIGID_BODY':
|
||||
row = layout.row()
|
||||
row.template_list("UI_UL_list", "", cache, "point_caches", cache.point_caches, "active_index", rows=2)
|
||||
row.template_list("UI_UL_list", "point_caches", cache, "point_caches",
|
||||
cache.point_caches, "active_index", rows=2)
|
||||
col = row.column(align=True)
|
||||
col.operator("ptcache.add", icon='ZOOMIN', text="")
|
||||
col.operator("ptcache.remove", icon='ZOOMOUT', text="")
|
||||
|
||||
@@ -36,12 +36,6 @@ class PHYSICS_PT_rigid_body(PHYSICS_PT_rigidbody_panel, Panel):
|
||||
return (obj and obj.rigid_body and
|
||||
(not context.scene.render.use_game_engine))
|
||||
|
||||
def draw_header(self, context):
|
||||
obj = context.object
|
||||
rbo = obj.rigid_body
|
||||
if rbo is not None:
|
||||
self.layout.prop(rbo, "enabled", text="")
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
@@ -50,7 +44,10 @@ class PHYSICS_PT_rigid_body(PHYSICS_PT_rigidbody_panel, Panel):
|
||||
|
||||
if rbo is not None:
|
||||
layout.prop(rbo, "type", text="Type")
|
||||
layout.prop(rbo, "kinematic", text="Animated")
|
||||
row = layout.row()
|
||||
if rbo.type == 'ACTIVE':
|
||||
row.prop(rbo, "enabled", text="Dynamic")
|
||||
row.prop(rbo, "kinematic", text="Animated")
|
||||
|
||||
if rbo.type == 'ACTIVE':
|
||||
layout.prop(rbo, "mass")
|
||||
|
||||
@@ -51,11 +51,12 @@ class PHYSICS_PT_rigid_body_constraint(PHYSICS_PT_rigidbody_constraint_panel, Pa
|
||||
layout.prop(rbc, "object1")
|
||||
layout.prop(rbc, "object2")
|
||||
|
||||
row = layout.row()
|
||||
row.prop(rbc, "use_breaking")
|
||||
sub = row.row()
|
||||
sub.active = rbc.use_breaking
|
||||
sub.prop(rbc, "breaking_threshold", text="Threshold")
|
||||
if rbc.type != 'MOTOR':
|
||||
row = layout.row()
|
||||
row.prop(rbc, "use_breaking")
|
||||
sub = row.row()
|
||||
sub.active = rbc.use_breaking
|
||||
sub.prop(rbc, "breaking_threshold", text="Threshold")
|
||||
|
||||
row = layout.row()
|
||||
row.prop(rbc, "override_solver_iterations", text="Override Iterations")
|
||||
@@ -113,6 +114,30 @@ class PHYSICS_PT_rigid_body_constraint(PHYSICS_PT_rigidbody_constraint_panel, Pa
|
||||
sub.prop(rbc, "limit_ang_x_lower", text="Lower")
|
||||
sub.prop(rbc, "limit_ang_x_upper", text="Upper")
|
||||
|
||||
elif rbc.type == 'MOTOR':
|
||||
col = layout.column(align=True)
|
||||
col.label("Linear motor:")
|
||||
|
||||
row = col.row()
|
||||
sub = row.row()
|
||||
sub.scale_x = 0.5
|
||||
sub.prop(rbc, "use_motor_lin", toggle=True, text="Enable")
|
||||
sub = row.row()
|
||||
sub.active = rbc.use_motor_lin
|
||||
sub.prop(rbc, "motor_lin_target_velocity", text="Target Velocity")
|
||||
sub.prop(rbc, "motor_lin_max_impulse", text="Max Impulse")
|
||||
|
||||
col.label("Angular motor:")
|
||||
|
||||
row = col.row()
|
||||
sub = row.row()
|
||||
sub.scale_x = 0.5
|
||||
sub.prop(rbc, "use_motor_ang", toggle=True, text="Enable")
|
||||
sub = row.row()
|
||||
sub.active = rbc.use_motor_ang
|
||||
sub.prop(rbc, "motor_ang_target_velocity", text="Target Velocity")
|
||||
sub.prop(rbc, "motor_ang_max_impulse", text="Max Impulse")
|
||||
|
||||
elif rbc.type in {'GENERIC', 'GENERIC_SPRING'}:
|
||||
col = layout.column(align=True)
|
||||
col.label("Limits:")
|
||||
|
||||
@@ -94,7 +94,7 @@ class SCENE_PT_keying_sets(SceneButtonsPanel, Panel):
|
||||
row = layout.row()
|
||||
|
||||
col = row.column()
|
||||
col.template_list("UI_UL_list", "", scene, "keying_sets", scene.keying_sets, "active_index", rows=2)
|
||||
col.template_list("UI_UL_list", "keying_sets", scene, "keying_sets", scene.keying_sets, "active_index", rows=2)
|
||||
|
||||
col = row.column(align=True)
|
||||
col.operator("anim.keying_set_add", icon='ZOOMIN', text="")
|
||||
|
||||
@@ -746,7 +746,7 @@ class CLIP_PT_stabilization(CLIP_PT_reconstruction_panel, Panel):
|
||||
layout.active = stab.use_2d_stabilization
|
||||
|
||||
row = layout.row()
|
||||
row.template_list("UI_UL_list", "", stab, "tracks",
|
||||
row.template_list("UI_UL_list", "stabilization_tracks", stab, "tracks",
|
||||
stab, "active_track_index", rows=3)
|
||||
|
||||
sub = row.column(align=True)
|
||||
|
||||
@@ -240,6 +240,10 @@ class DOPESHEET_MT_channel(Menu):
|
||||
|
||||
layout.operator("anim.channels_delete")
|
||||
|
||||
layout.separator()
|
||||
layout.operator("anim.channels_group")
|
||||
layout.operator("anim.channels_ungroup")
|
||||
|
||||
layout.separator()
|
||||
layout.operator_menu_enum("anim.channels_setting_toggle", "type")
|
||||
layout.operator_menu_enum("anim.channels_setting_enable", "type")
|
||||
|
||||
@@ -160,6 +160,10 @@ class GRAPH_MT_channel(Menu):
|
||||
|
||||
layout.operator("anim.channels_delete")
|
||||
|
||||
layout.separator()
|
||||
layout.operator("anim.channels_group")
|
||||
layout.operator("anim.channels_ungroup")
|
||||
|
||||
layout.separator()
|
||||
layout.operator_menu_enum("anim.channels_setting_toggle", "type")
|
||||
layout.operator_menu_enum("anim.channels_setting_enable", "type")
|
||||
|
||||
@@ -252,6 +252,7 @@ class NODE_PT_quality(bpy.types.Panel):
|
||||
|
||||
col = layout.column()
|
||||
col.prop(tree, "use_opencl")
|
||||
col.prop(tree, "use_groupnode_buffer")
|
||||
col.prop(tree, "two_pass")
|
||||
col.prop(snode, "show_highlight")
|
||||
col.prop(snode, "use_hidden_preview")
|
||||
|
||||
@@ -264,6 +264,8 @@ class VIEW3D_PT_tools_curveedit(View3DPanel, Panel):
|
||||
col.operator("curve.cyclic_toggle")
|
||||
col.operator("curve.switch_direction")
|
||||
col.operator("curve.spline_type_set")
|
||||
col.operator("curve.radius_set")
|
||||
col.operator("curve.smooth_radius")
|
||||
|
||||
col = layout.column(align=True)
|
||||
col.label(text="Handles:")
|
||||
@@ -278,6 +280,7 @@ class VIEW3D_PT_tools_curveedit(View3DPanel, Panel):
|
||||
col.label(text="Modeling:")
|
||||
col.operator("curve.extrude_move", text="Extrude")
|
||||
col.operator("curve.subdivide")
|
||||
col.operator("curve.smooth")
|
||||
|
||||
draw_repeat_tools(context, layout)
|
||||
|
||||
@@ -1054,6 +1057,11 @@ class VIEW3D_PT_tools_weightpaint_options(Panel, View3DPaintPanel):
|
||||
|
||||
col.prop(wpaint, "input_samples")
|
||||
|
||||
col.label("Show Zero Weights:")
|
||||
rowsub = col.row()
|
||||
rowsub.active = (not tool_settings.use_multipaint)
|
||||
rowsub.prop(tool_settings, "vertex_group_user", expand=True)
|
||||
|
||||
self.unified_paint_settings(col, context)
|
||||
|
||||
# Commented out because the Apply button isn't an operator yet, making these settings useless
|
||||
@@ -1222,7 +1230,7 @@ class VIEW3D_PT_tools_particlemode(View3DPanel, Panel):
|
||||
if pe.type == 'PARTICLES':
|
||||
if ob.particle_systems:
|
||||
if len(ob.particle_systems) > 1:
|
||||
layout.template_list("UI_UL_list", "", ob, "particle_systems",
|
||||
layout.template_list("UI_UL_list", "particle_systems", ob, "particle_systems",
|
||||
ob.particle_systems, "active_index", rows=2, maxrows=3)
|
||||
|
||||
ptcache = ob.particle_systems.active.point_cache
|
||||
@@ -1232,8 +1240,8 @@ class VIEW3D_PT_tools_particlemode(View3DPanel, Panel):
|
||||
ptcache = md.point_cache
|
||||
|
||||
if ptcache and len(ptcache.point_caches) > 1:
|
||||
layout.template_list("UI_UL_list", "", ptcache, "point_caches", ptcache.point_caches, "active_index",
|
||||
rows=2, maxrows=3)
|
||||
layout.template_list("UI_UL_list", "particles_point_caches", ptcache, "point_caches",
|
||||
ptcache.point_caches, "active_index", rows=2, maxrows=3)
|
||||
|
||||
if not pe.is_editable:
|
||||
layout.label(text="Point cache must be baked")
|
||||
|
||||
Reference in New Issue
Block a user