Merged changes in the trunk up to revision 53584.

Conflicts resolved:
release/scripts/startup/bl_ui/properties_render.py
source/blender/blenloader/intern/readfile.c
source/blender/editors/interface/interface_templates.c
source/blender/makesrna/RNA_enum_types.h

Also made additional code updates for:
r53355 UIList - Python-extendable list of UI items
r53460 Alpha premul pipeline cleanup
This commit is contained in:
2013-01-05 22:24:05 +00:00
577 changed files with 20475 additions and 7280 deletions

View File

@@ -47,7 +47,7 @@ _modules = [
import bpy
if 'FREESTYLE' in bpy.app.build_options:
if bpy.app.build_options.freestyle:
_modules.append("freestyle")
__import__(name=__name__, fromlist=_modules)
_namespace = globals()

View File

@@ -19,7 +19,6 @@
# <pep8-80 compliant>
import bpy
from bpy.types import Operator
import mathutils
from bpy.props import (FloatProperty,
IntProperty,
@@ -31,9 +30,7 @@ from bpy_extras import object_utils
def add_torus(major_rad, minor_rad, major_seg, minor_seg):
from math import cos, sin, pi
Vector = mathutils.Vector
Quaternion = mathutils.Quaternion
from mathutils import Vector, Quaternion
PI_2 = pi * 2.0
z_axis = 0.0, 0.0, 1.0

View File

@@ -187,17 +187,20 @@ class BakeAction(Operator):
)
only_selected = BoolProperty(
name="Only Selected",
description="Only key selected object/bones",
default=True,
)
clear_constraints = BoolProperty(
name="Clear Constraints",
description="Remove all constraints from keyed object/bones, and do 'visual' keying",
default=False,
)
bake_types = EnumProperty(
name="Bake Data",
description="Which data's transformations to bake",
options={'ENUM_FLAG'},
items=(('POSE', "Pose", ""),
('OBJECT', "Object", ""),
items=(('POSE', "Pose", "Bake bones transformations"),
('OBJECT', "Object", "Bake object transformations"),
),
default={'POSE'},
)
@@ -208,12 +211,12 @@ class BakeAction(Operator):
action = anim_utils.bake_action(self.frame_start,
self.frame_end,
self.step,
self.only_selected,
'POSE' in self.bake_types,
'OBJECT' in self.bake_types,
self.clear_constraints,
True,
frame_step=self.step,
only_selected=self.only_selected,
do_pose='POSE' in self.bake_types,
do_object='OBJECT' in self.bake_types,
do_constraint_clear=self.clear_constraints,
do_clean=True,
)
if action is None:

View File

@@ -20,7 +20,7 @@
import bpy
from bpy.types import Operator
from bpy.props import EnumProperty, StringProperty
from bpy.props import BoolProperty, EnumProperty, StringProperty
# Base class for node 'Add' operators
class NodeAddOperator():
@@ -75,6 +75,11 @@ class NODE_OT_add_node(NodeAddOperator, Operator):
name="Group tree",
description="Group node tree name",
)
use_transform = BoolProperty(
name="Use Transform",
description="Start transform operator after inserting the node",
default = False,
)
def execute(self, context):
node = self.create_node(context, self.type)
@@ -84,27 +89,13 @@ class NODE_OT_add_node(NodeAddOperator, Operator):
return {'FINISHED'}
# Adds a node and immediately starts the transform operator for inserting in a tree
class NODE_OT_add_node_move(NODE_OT_add_node):
'''Add a node to the active tree and start transform'''
bl_idname = "node.add_node_move"
bl_label = "Add Node and Move"
type = StringProperty(
name="Node Type",
description="Node type",
)
# optional group tree parameter for group nodes
group_tree = StringProperty(
name="Group tree",
description="Group node tree name",
)
def invoke(self, context, event):
self.store_mouse_cursor(context, event)
self.execute(context)
return bpy.ops.transform.translate('INVOKE_DEFAULT')
result = self.execute(context)
if self.use_transform and ('FINISHED' in result):
return bpy.ops.transform.translate('INVOKE_DEFAULT')
else:
return result
# XXX These node item lists should actually be generated by a callback at

View File

@@ -26,6 +26,7 @@ from bpy.types import Operator
def extend(obj, operator, EXTEND_MODE):
import bmesh
me = obj.data
# script will fail without UVs
@@ -46,12 +47,12 @@ def extend(obj, operator, EXTEND_MODE):
faces = [f for f in bm.faces if f.select and len(f.verts) == 4]
for f in faces:
f.tag = False
f_act.tag = True
# our own local walker
def walk_face_init(faces, f_act):
for f in faces:
f.tag = False
f_act.tag = True
def walk_face(f):
# all faces in this list must be tagged
f.tag = True
@@ -73,6 +74,30 @@ def extend(obj, operator, EXTEND_MODE):
faces_a, faces_b = faces_b, faces_a
faces_b.clear()
def walk_edgeloop(l):
"""
Could make this a generic function
"""
e_first = l.edge
e = None
while True:
e = l.edge
yield e
# don't step past non-manifold edges
if e.is_manifold:
# welk around the quad and then onto the next face
l = l.link_loop_radial_next
if len(l.face.verts) == 4:
l = l.link_loop_next.link_loop_next
if l.edge is e_first:
break
else:
break
else:
break
def extrapolate_uv(fac,
l_a_outer, l_a_inner,
l_b_outer, l_b_inner):
@@ -119,7 +144,9 @@ def extend(obj, operator, EXTEND_MODE):
l_a_uv = [l[uv_act].uv for l in l_a]
l_b_uv = [l[uv_act].uv for l in l_b]
if EXTEND_MODE == 'LENGTH':
if EXTEND_MODE == 'LENGTH_AVERAGE':
fac = edge_lengths[l_b[2].edge.index][0] / edge_lengths[l_a[1].edge.index][0]
elif EXTEND_MODE == 'LENGTH':
a0, b0, c0 = l_a[3].vert.co, l_a[0].vert.co, l_b[3].vert.co
a1, b1, c1 = l_a[2].vert.co, l_a[1].vert.co, l_b[2].vert.co
@@ -140,6 +167,40 @@ def extend(obj, operator, EXTEND_MODE):
l_a_uv[2], l_a_uv[1],
l_b_uv[2], l_b_uv[1])
# -------------------------------------------
# Calculate average length per loop if needed
if EXTEND_MODE == 'LENGTH_AVERAGE':
bm.edges.index_update()
edge_lengths = [None] * len(bm.edges)
for f in faces:
# we know its a quad
l_quad = f.loops[:]
l_pair_a = (l_quad[0], l_quad[2])
l_pair_b = (l_quad[1], l_quad[3])
for l_pair in (l_pair_a, l_pair_b):
if edge_lengths[l_pair[0].edge.index] is None:
edge_length_store = [-1.0]
edge_length_accum = 0.0
edge_length_total = 0
for l in l_pair:
if edge_lengths[l.edge.index] is None:
for e in walk_edgeloop(l):
if edge_lengths[e.index] is None:
edge_lengths[e.index] = edge_length_store
edge_length_accum += e.calc_length()
edge_length_total += 1
edge_length_store[0] = edge_length_accum / edge_length_total
# done with average length
# ------------------------
walk_face_init(faces, f_act)
for f_triple in walk_face(f_act):
apply_uv(*f_triple)
@@ -162,8 +223,10 @@ class FollowActiveQuads(Operator):
name="Edge Length Mode",
description="Method to space UV edge loops",
items=(('EVEN', "Even", "Space all UVs evenly"),
('LENGTH', "Length", "Average space UVs edge length of each loop")),
default='LENGTH',
('LENGTH', "Length", "Average space UVs edge length of each loop"),
('LENGTH_AVERAGE', "Length Average", "Average space UVs edge length of each loop"),
),
default='LENGTH_AVERAGE',
)
@classmethod

View File

@@ -127,13 +127,14 @@ def applyVertexDirt(me, blur_iterations, blur_strength, clamp_dirt, clamp_clean,
col[0] = tone * col[0]
col[1] = tone * col[1]
col[2] = tone * col[2]
me.update()
return {'FINISHED'}
import bpy
from bpy.types import Operator
from bpy.props import FloatProperty, IntProperty, BoolProperty
from math import pi
class VertexPaintDirt(Operator):
@@ -156,14 +157,16 @@ class VertexPaintDirt(Operator):
clean_angle = FloatProperty(
name="Highlight Angle",
description="Less than 90 limits the angle used in the tonal range",
min=0.0, max=180.0,
default=180.0,
min=0.0, max=pi,
default=pi,
unit="ROTATION",
)
dirt_angle = FloatProperty(
name="Dirt Angle",
description="Less than 90 limits the angle used in the tonal range",
min=0.0, max=180.0,
min=0.0, max=pi,
default=0.0,
unit="ROTATION",
)
dirt_only = BoolProperty(
name="Dirt Only",
@@ -171,20 +174,21 @@ class VertexPaintDirt(Operator):
default=False,
)
@classmethod
def poll(cls, context):
obj = context.object
return (obj and obj.type == 'MESH')
def execute(self, context):
import time
from math import radians
obj = context.object
if not obj or obj.type != 'MESH':
self.report({'ERROR'}, "Error, no active mesh object, aborting")
return {'CANCELLED'}
mesh = obj.data
t = time.time()
ret = applyVertexDirt(mesh, self.blur_iterations, self.blur_strength, radians(self.dirt_angle), radians(self.clean_angle), self.dirt_only)
ret = applyVertexDirt(mesh, self.blur_iterations, self.blur_strength, self.dirt_angle, self.clean_angle, self.dirt_only)
print('Dirt calculated in %.6f' % (time.time() - t))