Sculpt Branch:

svn merge https://svn.blender.org/svnroot/bf-blender/trunk/blender -r25180:25245
This commit is contained in:
Brecht Van Lommel 2009-12-09 15:24:55 +00:00
commit 6639ba6b86
140 changed files with 9612 additions and 9172 deletions

View File

@ -33,9 +33,9 @@ IF(WINDOWS)
ADD_DEFINITIONS(-DUSE_MSVC6FIXES)
ENDIF(WINDOWS)
IF(WITH_OPENMP)
IF(WITH_OPENMP AND NOT APPLE)
ADD_DEFINITIONS(-DPARALLEL=1)
ENDIF(WITH_OPENMP)
ENDIF(WITH_OPENMP AND NOT APPLE)
BLENDERLIB_NOLIST(bf_elbeem "${SRC}" "${INC}")
#, libtype='blender', priority=0 )

View File

@ -8,7 +8,8 @@ sources = env.Glob('intern/*.cpp')
defs = 'NOGUI ELBEEM_BLENDER=1'
if env['WITH_BF_OPENMP']:
defs += ' PARALLEL'
if env['OURPLATFORM'] != 'darwin':
defs += ' PARALLEL'
if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'):
defs += ' USE_MSVC6FIXES'

View File

@ -631,10 +631,6 @@
RelativePath="..\..\..\source\blender\editors\space_graph\graph_edit.c"
>
</File>
<File
RelativePath="..\..\..\source\blender\editors\space_graph\graph_header.c"
>
</File>
<File
RelativePath="..\..\..\source\blender\editors\space_graph\graph_intern.h"
>
@ -835,10 +831,6 @@
RelativePath="..\..\..\source\blender\editors\space_action\action_edit.c"
>
</File>
<File
RelativePath="..\..\..\source\blender\editors\space_action\action_header.c"
>
</File>
<File
RelativePath="..\..\..\source\blender\editors\space_action\action_intern.h"
>
@ -875,10 +867,6 @@
RelativePath="..\..\..\source\blender\editors\space_nla\nla_edit.c"
>
</File>
<File
RelativePath="..\..\..\source\blender\editors\space_nla\nla_header.c"
>
</File>
<File
RelativePath="..\..\..\source\blender\editors\space_nla\nla_intern.h"
>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 204 KiB

After

Width:  |  Height:  |  Size: 204 KiB

View File

@ -51,7 +51,7 @@ def compat_str(text, line_length=0):
return "* " + text
def graph_armature(obj, path, FAKE_PARENT=True, CONSTRAINTS=True, DRIVERS=True, XTRA_INFO=False):
def graph_armature(obj, path, FAKE_PARENT=True, CONSTRAINTS=True, DRIVERS=True, XTRA_INFO=True):
CONSTRAINTS = DRIVERS = True
fileobject = open(path, "w")
@ -131,7 +131,7 @@ def graph_armature(obj, path, FAKE_PARENT=True, CONSTRAINTS=True, DRIVERS=True,
if XTRA_INFO:
label = "%s\n%s" % (constraint.type, constraint.name)
opts.append('label="%s"' % compat_str(label))
fw('"%s" -> "%s" [%s] ;\n' % (subtarget, pbone.name, ','.join(opts)))
fw('"%s" -> "%s" [%s] ;\n' % (pbone.name, subtarget, ','.join(opts)))
# Drivers
if DRIVERS:

View File

@ -73,19 +73,23 @@ def _bone_class_instance_rename(self, attr, new_name):
setattr(self, attr, ebone.name)
def _bone_class_instance_copy(self, from_prefix="", to_prefix=""):
def _bone_class_instance_copy(self, from_fmt="%s", to_fmt="%s", exclude_attrs=(), base_names=None):
from_name_ls = []
new_name_ls = []
new_slot_ls = []
for attr in self.attr_names:
if attr in exclude_attrs:
continue
bone_name_orig = getattr(self, attr)
ebone = getattr(self, attr + "_e")
# orig_names[attr] = bone_name_orig
# insert prefix
if from_prefix:
bone_name = from_prefix + bone_name_orig
# insert formatting
if from_fmt != "%s":
bone_name = from_fmt % bone_name_orig
ebone.name = bone_name
bone_name = ebone.name # cant be sure we get what we ask for
else:
@ -95,8 +99,9 @@ def _bone_class_instance_copy(self, from_prefix="", to_prefix=""):
new_slot_ls.append(attr)
from_name_ls.append(bone_name)
bone_name_orig = bone_name_orig.replace("ORG-", "") # XXX - we need a better way to do this
new_name_ls.append(to_prefix + bone_name_orig)
if base_names:
bone_name_orig = base_names[bone_name_orig]
new_name_ls.append(to_fmt % bone_name_orig)
new_bones = copy_bone_simple_list(self.obj.data, from_name_ls, new_name_ls, True)
new_bc = bone_class_instance(self.obj, new_slot_ls)
@ -134,6 +139,10 @@ def _bone_class_instance_blend(self, from_bc, to_bc, target_bone=None, target_pr
def bone_class_instance(obj, slots, name="BoneContainer"):
if len(slots) != len(set(slots)):
raise Exception("duplicate entries found %s" % attr_names)
attr_names = tuple(slots) # dont modify the original
slots = list(slots) # dont modify the original
for i in range(len(slots)):
@ -210,6 +219,11 @@ def blend_bone_list(obj, apply_bones, from_bones, to_bones, target_bone=None, ta
if obj.mode == 'EDIT':
raise Exception("blending cant be called in editmode")
if len(apply_bones) != len(from_bones):
raise Exception("lists differ in length (from -> apply): \n\t%s\n\t%s" % (from_bones, apply_bones))
if len(apply_bones) != len(to_bones):
raise Exception("lists differ in length (to -> apply): \n\t%s\n\t%s" % (to_bones, apply_bones))
# setup the blend property
if target_bone is None:
target_bone = apply_bones[-1] # default to the last bone
@ -272,10 +286,12 @@ def blend_bone_list(obj, apply_bones, from_bones, to_bones, target_bone=None, ta
new_pbone = obj.pose.bones[new_bone_name]
if not new_pbone.bone.connected:
# if the bone is connected or its location is totally locked then dont add location blending.
if not (new_pbone.bone.connected or (False not in new_pbone.lock_location)):
blend_location(new_pbone, from_bone_name, to_bone_name)
blend_rotation(new_pbone, from_bone_name, to_bone_name)
if not (False not in new_pbone.lock_rotation): # TODO. 4D chech?
blend_rotation(new_pbone, from_bone_name, to_bone_name)
def add_stretch_to(obj, from_name, to_name, name):
@ -317,7 +333,8 @@ def add_stretch_to(obj, from_name, to_name, name):
con.volume = 'NO_VOLUME'
bpy.ops.object.mode_set(mode=mode_orig)
return stretch_name
def add_pole_target_bone(obj, base_name, name, mode='CROSS'):
'''
@ -342,11 +359,18 @@ def add_pole_target_bone(obj, base_name, name, mode='CROSS'):
parent_dir = parent_head - parent_tail
distance = (base_dir.length + parent_dir.length)
if mode == 'CROSS':
# direction from the angle of the joint
offset = base_dir.copy().normalize() - parent_dir.copy().normalize()
offset.length = distance
elif mode == 'ZAVERAGE':
# between both bones Z axis
z_axis_a = base_ebone.matrix.copy().rotationPart() * Vector(0.0, 0.0, -1.0)
z_axis_b = parent_ebone.matrix.copy().rotationPart() * Vector(0.0, 0.0, -1.0)
offset = (z_axis_a + z_axis_b).normalize() * distance
else:
# preset axis
offset = Vector(0, 0, 0)
if mode[0] == "+":
val = distance
@ -363,7 +387,7 @@ def add_pole_target_bone(obj, base_name, name, mode='CROSS'):
return poll_name
def generate_rig(context, obj_orig, prefix="ORG-"):
def generate_rig(context, obj_orig, prefix="ORG-", META_DEF=True):
from collections import OrderedDict
global_undo = context.user_preferences.edit.global_undo
@ -371,20 +395,28 @@ def generate_rig(context, obj_orig, prefix="ORG-"):
bpy.ops.object.mode_set(mode='OBJECT')
scene = context.scene
# copy object and data
obj_orig.selected = False
obj = obj_orig.copy()
obj.data = obj_orig.data.copy()
scene = context.scene
scene.objects.link(obj)
scene.objects.active = obj
obj.selected = True
if META_DEF:
obj_def = obj_orig.copy()
obj_def.data = obj_orig.data.copy()
scene.objects.link(obj_def)
arm = obj.data
# original name mapping
base_names = {}
# add all new parentless children to this bone
root_bone = None
bpy.ops.object.mode_set(mode='EDIT')
for bone in arm.edit_bones:
@ -407,10 +439,23 @@ def generate_rig(context, obj_orig, prefix="ORG-"):
# inspect all bones and assign their definitions before modifying
for pbone in obj.pose.bones:
bone_name = pbone.name
bone_type = obj.pose.bones[bone_name].get("type", "")
bone_type_list = [bt for bt in bone_type.replace(",", " ").split()]
bone_type = pbone.get("type", "")
if bone_type:
bone_type_list = [bt for bt in bone_type.replace(",", " ").split()]
# not essential but means running autorig again wont do anything
del pbone["type"]
else:
bone_type_list = []
if bone_type_list == ["root"]: # special case!
if root_bone:
raise Exception("cant have more then 1 root bone, found '%s' and '%s' to have type==root" % (root_bone, bone_name))
root_bone = bone_name
bone_type_list[:] = []
for bone_type in bone_type_list:
type_pair = bone_type.split(".")
# 'leg.ik' will look for an ik function in the leg module
@ -450,7 +495,7 @@ def generate_rig(context, obj_orig, prefix="ORG-"):
if bone_name not in bone_typeinfos:
continue
bone_def_dict = bone_definitions[bone_name]
# Only blend results from the same submodule, eg.
@ -478,10 +523,34 @@ def generate_rig(context, obj_orig, prefix="ORG-"):
definition = bone_def_dict[submod_name]
if len(result_submod) == 2:
blend_bone_list(obj, definition, result_submod[0], result_submod[1])
blend_bone_list(obj, definition, result_submod[0], result_submod[1], target_bone=bone_name)
# needed to update driver deps
# context.scene.update()
if root_bone:
# assign all new parentless bones to this
bpy.ops.object.mode_set(mode='EDIT')
root_ebone = arm.edit_bones[root_bone]
for ebone in arm.edit_bones:
if ebone.parent is None and ebone.name not in base_names:
ebone.connected = False
ebone.parent = root_ebone
bpy.ops.object.mode_set(mode='OBJECT')
if META_DEF:
# for pbone in obj_def.pose.bones:
for bone_name, bone_name_new in base_names.items():
#pbone_from = bone_name
pbone = obj_def.pose.bones[bone_name_new]
con = pbone.constraints.new('COPY_ROTATION')
con.target = obj
con.subtarget = bone_name
if not pbone.bone.connected:
con = pbone.constraints.new('COPY_LOCATION')
con.target = obj
con.subtarget = bone_name
# Only for demo'ing

View File

@ -19,13 +19,15 @@
# <pep8 compliant>
import bpy
from rigify import bone_class_instance, copy_bone_simple, add_pole_target_bone, add_stretch_to
from rigify import bone_class_instance, copy_bone_simple, add_pole_target_bone, add_stretch_to, blend_bone_list
from rna_prop_ui import rna_idprop_ui_prop_get
from Mathutils import Vector
METARIG_NAMES = "shoulder", "arm", "forearm", "hand"
def metarig_template():
# generated by rigify.write_meta_rig
bpy.ops.object.mode_set(mode='EDIT')
obj = bpy.context.object
arm = obj.data
@ -64,10 +66,13 @@ def metarig_definition(obj, orig_bone_name):
mt.update()
mt.shoulder_p = mt.arm_p.parent
if not mt.shoulder_p:
raise Exception("could not find 'arm' parent, skipping:", orig_bone_name)
print(mt.shoulder_p)
raise Exception("could not find '%s' parent, skipping:" % orig_bone_name)
if mt.arm_p.parent.bone.connected:
raise Exception("expected '%s' to be disconnected from its parent" % orig_bone_name)
mt.shoulder = mt.shoulder_p.name
# We could have some bones attached, find the bone that has this as its 2nd parent
@ -77,8 +82,8 @@ def metarig_definition(obj, orig_bone_name):
if index == 2:
hands.append(pbone)
if len(hands) > 1:
raise Exception("more then 1 hand found on:", orig_bone_name)
if len(hands) != 1:
raise Exception("Expected more then 1 hand found on:", orig_bone_name)
# first add the 2 new bones
mt.hand_p = hands[0]
@ -90,232 +95,135 @@ def metarig_definition(obj, orig_bone_name):
return mt.names()
def main(obj, definitions, base_names):
"""
the bone with the 'arm' property is the upper arm, this assumes a chain as follows.
[shoulder, upper_arm, forearm, hand]
...where this bone is 'upper_arm'
there are 3 chains
- Original
- IK, MCH-%s_ik
- IKSwitch, MCH-%s ()
"""
# Since there are 3 chains, this gets confusing so divide into 3 chains
# Initialize container classes for convenience
mt = bone_class_instance(obj, METARIG_NAMES) # meta
def ik(obj, definitions, base_names):
mt = bone_class_instance(obj, METARIG_NAMES)
mt.shoulder, mt.arm, mt.forearm, mt.hand = definitions
mt.update()
ik = bone_class_instance(obj, ["pole", "pole_vis", "hand_vis"])
ik_chain = mt.copy(to_fmt="MCH-%s_ik", base_names=base_names, exclude_attrs=["shoulder"])
# IK needs no parent_index
ik_chain.hand_e.connected = False
ik_chain.hand_e.parent = None
ik = bone_class_instance(obj, ["arm", "forearm", "pole", "hand"]) # ik
sw = bone_class_instance(obj, ["socket", "shoulder", "arm", "forearm", "hand"]) # hinge
ex = bone_class_instance(obj, ["arm_hinge"]) # hinge & extras
ik_chain.arm_e.connected = False
ik_chain.arm_e.parent = mt.shoulder_e
# Add the bone used for the arms poll target
ik.pole = add_pole_target_bone(obj, mt.forearm, "elbow_poll", mode='ZAVERAGE')
# update bones after this!
ik.hand_vis = add_stretch_to(obj, mt.hand, ik_chain.hand, "VIS-%s_ik" % base_names[mt.hand])
ik.pole_vis = add_stretch_to(obj, mt.forearm, ik.pole, "VIS-%s_ik" % base_names[mt.forearm])
ik.update()
ik.hand_vis_e.restrict_select = True
ik.pole_vis_e.restrict_select = True
bpy.ops.object.mode_set(mode='OBJECT')
mt.update()
ik.update()
ik_chain.update()
# Set IK dof
ik_chain.forearm_p.ik_dof_x = True
ik_chain.forearm_p.ik_dof_y = False
ik_chain.forearm_p.ik_dof_z = False
con = ik_chain.forearm_p.constraints.new('IK')
con.target = obj
con.subtarget = ik_chain.hand
con.pole_target = obj
con.pole_subtarget = ik.pole
con.use_tail = True
con.use_stretch = True
con.use_target = True
con.use_rotation = False
con.chain_length = 2
con.pole_angle = -90.0 # XXX, RAD2DEG
# ID Propery on the hand for IK/FK switch
prop = rna_idprop_ui_prop_get(ik_chain.hand_p, "ik", create=True)
ik_chain.hand_p["ik"] = 0.5
prop["soft_min"] = 0.0
prop["soft_max"] = 1.0
bpy.ops.object.mode_set(mode='EDIT')
# don't blend the shoulder
return [None] + ik_chain.names()
def fk(obj, definitions, base_names):
arm = obj.data
mt = bone_class_instance(obj, METARIG_NAMES)
mt.shoulder, mt.arm, mt.forearm, mt.hand = definitions
mt.update()
def chain_ik(prefix="MCH-%s_ik"):
ex = bone_class_instance(obj, ["socket", "arm_hinge", "hand_delta"])
fk_chain = mt.copy(base_names=base_names)
mt.update()
# shoulder is used as a hinge
fk_chain.rename("shoulder", "MCH-%s_hinge" % base_names[mt.arm])
fk_chain.shoulder_e.translate(Vector(0.0, fk_chain.shoulder_e.length / 2, 0.0))
# Add the edit bones
ik.hand_e = copy_bone_simple(arm, mt.hand, prefix % base_names[mt.hand])
ik.hand = ik.hand_e.name
# upper arm constrains to this.
ex.socket_e = copy_bone_simple(arm, mt.arm, "MCH-%s_socket" % base_names[mt.arm])
ex.socket = ex.socket_e.name
ex.socket_e.connected = False
ex.socket_e.parent = mt.shoulder_e
ex.socket_e.tail = mt.shoulder_e.tail
# insert the 'DLT-hand', between the forearm and the hand
# copies forarm rotation
ex.hand_delta_e = copy_bone_simple(arm, fk_chain.hand, "DLT-%s" % base_names[mt.hand], parent=True)
ex.hand_delta = ex.hand_delta_e.name
ex.hand_delta_e.length *= 0.5
ex.hand_delta_e.connected = False
fk_chain.hand_e.connected = False
fk_chain.hand_e.parent = ex.hand_delta_e
ik.arm_e = copy_bone_simple(arm, mt.arm, prefix % base_names[mt.arm])
ik.arm = ik.arm_e.name
bpy.ops.object.mode_set(mode='OBJECT')
mt.update()
ex.update()
fk_chain.update()
ik.forearm_e = copy_bone_simple(arm, mt.forearm, prefix % base_names[mt.forearm])
ik.forearm = ik.forearm_e.name
ik.arm_e.parent = mt.arm_e.parent
ik.forearm_e.connected = mt.arm_e.connected
ik.forearm_e.parent = ik.arm_e
ik.forearm_e.connected = True
# Add the bone used for the arms poll target
ik.pole = add_pole_target_bone(obj, mt.forearm, "elbow_poll", mode='+Z')
bpy.ops.object.mode_set(mode='OBJECT')
ik.update()
con = ik.forearm_p.constraints.new('IK')
con.target = obj
con.subtarget = ik.hand
con.pole_target = obj
con.pole_subtarget = ik.pole
con.use_tail = True
con.use_stretch = True
con.use_target = True
con.use_rotation = False
con.chain_length = 2
con.pole_angle = -90.0 # XXX, RAD2DEG
# ID Propery on the hand for IK/FK switch
prop = rna_idprop_ui_prop_get(ik.hand_p, "ik", create=True)
ik.hand_p["ik"] = 0.5
prop["soft_min"] = 0.0
prop["soft_max"] = 1.0
bpy.ops.object.mode_set(mode='EDIT')
def chain_switch(prefix="MCH-%s"):
print(mt.obj.mode)
sw.update()
mt.update()
sw.shoulder_e = copy_bone_simple(arm, mt.shoulder, prefix % base_names[mt.shoulder])
sw.shoulder = sw.shoulder_e.name
sw.shoulder_e.parent = mt.shoulder_e.parent
sw.shoulder_e.connected = mt.shoulder_e.connected
sw.arm_e = copy_bone_simple(arm, mt.arm, prefix % base_names[mt.arm])
sw.arm = sw.arm_e.name
sw.arm_e.parent = sw.shoulder_e
sw.arm_e.connected = arm.edit_bones[mt.shoulder].connected
sw.forearm_e = copy_bone_simple(arm, mt.forearm, prefix % base_names[mt.forearm])
sw.forearm = sw.forearm_e.name
sw.forearm_e.parent = sw.arm_e
sw.forearm_e.connected = arm.edit_bones[mt.forearm].connected
sw.hand_e = copy_bone_simple(arm, mt.hand, prefix % base_names[mt.hand])
sw.hand = sw.hand_e.name
sw.hand_e.parent = sw.forearm_e
sw.hand_e.connected = arm.edit_bones[mt.hand].connected
# The sw.hand_e needs to own all the children on the metarig's hand
for child in mt.hand_e.children:
child.parent = sw.hand_e
# These are made the children of sw.shoulder_e
bpy.ops.object.mode_set(mode='OBJECT')
# Add constraints
sw.update()
#dummy, ik.arm, ik.forearm, ik.hand, ik.pole = ik_chain_tuple
ik_driver_path = obj.pose.bones[ik.hand].path_to_id() + '["ik"]'
def ik_fk_driver(con):
'''
3 bones use this for ik/fk switching
'''
fcurve = con.driver_add("influence", 0)
driver = fcurve.driver
tar = driver.targets.new()
driver.type = 'AVERAGE'
tar.name = "ik"
tar.id_type = 'OBJECT'
tar.id = obj
tar.rna_path = ik_driver_path
# ***********
con = sw.arm_p.constraints.new('COPY_ROTATION')
con.name = "FK"
con.target = obj
con.subtarget = mt.arm
con = sw.arm_p.constraints.new('COPY_ROTATION')
con.target = obj
con.subtarget = ik.arm
con.influence = 0.5
ik_fk_driver(con)
# ***********
con = sw.forearm_p.constraints.new('COPY_ROTATION')
con.name = "FK"
con.target = obj
con.subtarget = mt.forearm
con = sw.forearm_p.constraints.new('COPY_ROTATION')
con.name = "IK"
con.target = obj
con.subtarget = ik.forearm
con.influence = 0.5
ik_fk_driver(con)
# ***********
con = sw.hand_p.constraints.new('COPY_ROTATION')
con.name = "FK"
con.target = obj
con.subtarget = mt.hand
con = sw.hand_p.constraints.new('COPY_ROTATION')
con.name = "IK"
con.target = obj
con.subtarget = ik.hand
con.influence = 0.5
ik_fk_driver(con)
add_stretch_to(obj, sw.forearm, ik.pole, "VIS-elbow_ik_poll")
add_stretch_to(obj, sw.hand, ik.hand, "VIS-hand_ik")
bpy.ops.object.mode_set(mode='EDIT')
def chain_shoulder(prefix="MCH-%s"):
sw.socket_e = copy_bone_simple(arm, mt.arm, (prefix % base_names[mt.arm]) + "_socket")
sw.socket = sw.socket_e.name
sw.socket_e.tail = arm.edit_bones[mt.shoulder].tail
# Set the shoulder as parent
ik.update()
sw.update()
mt.update()
sw.socket_e.parent = sw.shoulder_e
ik.arm_e.parent = sw.shoulder_e
# ***** add the shoulder hinge
# yes this is correct, the shoulder copy gets the arm's name
ex.arm_hinge_e = copy_bone_simple(arm, mt.shoulder, (prefix % base_names[mt.arm]) + "_hinge")
ex.arm_hinge = ex.arm_hinge_e.name
offset = ex.arm_hinge_e.length / 2.0
ex.arm_hinge_e.head.y += offset
ex.arm_hinge_e.tail.y += offset
# Note: meta arm becomes child of hinge
mt.arm_e.parent = ex.arm_hinge_e
bpy.ops.object.mode_set(mode='OBJECT')
ex.update()
con = mt.arm_p.constraints.new('COPY_LOCATION')
con.target = obj
con.subtarget = sw.socket
# Set rotation modes and axis locks
fk_chain.forearm_p.rotation_mode = 'XYZ'
fk_chain.forearm_p.lock_rotation = (False, True, True)
fk_chain.hand_p.rotation_mode = 'ZXY'
con = fk_chain.arm_p.constraints.new('COPY_LOCATION')
con.target = obj
con.subtarget = ex.socket
fk_chain.hand_p.lock_location = True, True, True
con = ex.hand_delta_p.constraints.new('COPY_ROTATION')
con.target = obj
con.subtarget = fk_chain.forearm
def hinge_setup():
# Hinge constraint & driver
con = ex.arm_hinge_p.constraints.new('COPY_ROTATION')
con = fk_chain.shoulder_p.constraints.new('COPY_ROTATION')
con.name = "hinge"
con.target = obj
con.subtarget = sw.shoulder
con.subtarget = mt.shoulder
driver_fcurve = con.driver_add("influence", 0)
driver = driver_fcurve.driver
controller_path = mt.arm_p.path_to_id()
controller_path = fk_chain.arm_p.path_to_id()
# add custom prop
mt.arm_p["hinge"] = 0.0
prop = rna_idprop_ui_prop_get(mt.arm_p, "hinge", create=True)
fk_chain.arm_p["hinge"] = 0.0
prop = rna_idprop_ui_prop_get(fk_chain.arm_p, "hinge", create=True)
prop["soft_min"] = 0.0
prop["soft_max"] = 1.0
@ -330,16 +238,21 @@ def main(obj, definitions, base_names):
tar.id = obj
tar.rna_path = controller_path + '["hinge"]'
mod = driver_fcurve.modifiers[0]
mod.poly_order = 1
mod.coefficients[0] = 1.0
mod.coefficients[1] = -1.0
bpy.ops.object.mode_set(mode='EDIT')
hinge_setup()
bpy.ops.object.mode_set(mode='EDIT')
# remove the shoulder and re-parent
return None, fk_chain.arm, fk_chain.forearm, fk_chain.hand
chain_ik()
chain_switch()
chain_shoulder()
# Shoulder with its delta and hinge.
def main(obj, bone_definition, base_names):
bones_ik = ik(obj, bone_definition, base_names)
bones_fk = fk(obj, bone_definition, base_names)
# TODO - return a list for fk and IK
return None
bpy.ops.object.mode_set(mode='OBJECT')
blend_bone_list(obj, bone_definition, bones_ik, bones_fk, target_bone=bone_definition[1])

View File

@ -86,14 +86,14 @@ def main(obj, bone_definition, base_names):
del child_pbone
bpy.ops.object.mode_set(mode='OBJECT')
# Move the child bone to the deltas location
obj.animation_data_create()
delta_pbone = obj.pose.bones[delta_name]
# child_pbone = obj.pose.bones[child_name]
# ------------------- drivers
delta_pbone.rotation_mode = 'XYZ'

View File

@ -146,7 +146,7 @@ def ik(obj, bone_definition, base_names):
# Make a new chain, ORG are the original bones renamed.
ik_chain = mt_chain.copy(to_prefix="MCH-")
ik_chain = mt_chain.copy(to_fmt="MCH-%s")
# simple rename
ik_chain.rename("thigh", ik_chain.thigh + "_ik")
@ -213,6 +213,11 @@ def ik(obj, bone_definition, base_names):
mt_chain.update()
ik_chain.update()
# Set IK dof
ik_chain.shin_p.ik_dof_x = True
ik_chain.shin_p.ik_dof_y = False
ik_chain.shin_p.ik_dof_z = False
# IK
con = ik_chain.shin_p.constraints.new('IK')
con.chain_length = 2
@ -225,7 +230,7 @@ def ik(obj, bone_definition, base_names):
con.weight = 1.0
con.target = obj
con.subtarget = ik.foot
con.subtarget = ik_chain.foot
con.pole_target = obj
con.pole_subtarget = ik.knee_target
@ -279,7 +284,7 @@ def fk(obj, bone_definition, base_names):
ex.thigh_socket = ex.thigh_socket_e.name
ex.thigh_socket_e.tail = ex.thigh_socket_e.head + Vector(0.0, 0.0, ex.thigh_socket_e.length / 4.0)
ex.thigh_hinge_e = copy_bone_simple(arm, mt_chain.thigh, "MCH-%s_hinge" % base_names[mt_chain.thigh], parent=True)
ex.thigh_hinge_e = copy_bone_simple(arm, mt_chain.thigh, "MCH-%s_hinge" % base_names[mt_chain.thigh])
ex.thigh_hinge = ex.thigh_hinge_e.name
ex.thigh_hinge_e.tail = ex.thigh_hinge_e.head + Vector(0.0, 0.0, mt_chain.thigh_e.head.length)
ex.thigh_hinge_e.translate(Vector( - (mt.hips_e.head.x - mt_chain.thigh_e.head.x), 0.0, 0.0))
@ -338,4 +343,4 @@ def main(obj, bone_definition, base_names):
bones_fk = fk(obj, bone_definition, base_names)
bpy.ops.object.mode_set(mode='OBJECT')
blend_bone_list(obj, bone_definition, bones_ik, bones_fk)
blend_bone_list(obj, bone_definition, bones_ik, bones_fk, target_bone=bone_definition[1])

View File

@ -27,19 +27,20 @@ METARIG_NAMES = ("body", "head")
def metarig_template():
# generated by rigify.write_meta_rig
bpy.ops.object.mode_set(mode='EDIT')
obj = bpy.context.object
arm = obj.data
bone = arm.edit_bones.new('body')
bone.head[:] = -0.0000, -0.2771, -1.3345
bone.tail[:] = -0.0000, -0.1708, -0.3984
bone.tail[:] = -0.0000, -0.1708, -0.1984
bone.roll = 0.0000
bone.connected = False
bone = arm.edit_bones.new('head')
bone.head[:] = -0.0000, -0.1708, -0.1984
bone.tail[:] = 0.0000, -0.1708, 1.6016
bone.roll = -0.0000
bone.connected = False
bone.tail[:] = 0.0000, 0.7292, 1.3604
bone.roll = 0.0000
bone.connected = True
bone.parent = arm.edit_bones['body']
bone = arm.edit_bones.new('neck.01')
bone.head[:] = 0.0000, -0.1708, -0.1984
@ -116,7 +117,7 @@ def main(obj, bone_definition, base_names):
setattr(mt_chain, attr, neck_chain[i])
mt_chain.update()
neck_chain_basename = mt_chain.neck_01_e.basename
neck_chain_basename = base_names[mt_chain.neck_01_e.name].split(".")[0]
neck_chain_segment_length = mt_chain.neck_01_e.length
ex = bone_class_instance(obj, ["body", "head", "head_hinge", "neck_socket"]) # hinge & extras
@ -125,7 +126,8 @@ def main(obj, bone_definition, base_names):
# Copy the head bone and offset
ex.head_e = copy_bone_simple(arm, mt.head, "MCH_%s" % mt.head, parent=True)
ex.head_e = copy_bone_simple(arm, mt.head, "MCH_%s" % base_names[mt.head], parent=True)
ex.head_e.connected = False
ex.head = ex.head_e.name
# offset
head_length = ex.head_e.length
@ -133,17 +135,20 @@ def main(obj, bone_definition, base_names):
ex.head_e.tail.y += head_length / 2.0
# Yes, use the body bone but call it a head hinge
ex.head_hinge_e = copy_bone_simple(arm, mt.body, "MCH_%s_hinge" % mt.head, parent=True)
ex.head_hinge_e = copy_bone_simple(arm, mt.body, "MCH_%s_hinge" % base_names[mt.head], parent=True)
ex.head_hinge_e.connected = False
ex.head_hinge = ex.head_hinge_e.name
ex.head_hinge_e.head.y += head_length / 4.0
ex.head_hinge_e.tail.y += head_length / 4.0
# reparent the head, assume its not connected
mt.head_e.connected = False
mt.head_e.parent = ex.head_hinge_e
# Insert the neck socket, the head copys this loation
ex.neck_socket_e = arm.edit_bones.new("MCH-%s_socked" % neck_chain_basename)
ex.neck_socket = ex.neck_socket_e.name
ex.neck_socket_e.connected = False
ex.neck_socket_e.parent = mt.body_e
ex.neck_socket_e.head = mt.head_e.head
ex.neck_socket_e.tail = mt.head_e.head - Vector(0.0, neck_chain_segment_length / 2.0, 0.0)
@ -157,10 +162,10 @@ def main(obj, bone_definition, base_names):
neck_e = getattr(mt_chain, attr + "_e")
# dont store parent names, re-reference as each chain bones parent.
neck_e_parent = arm.edit_bones.new("MCH-rot_%s" % neck_e.name)
neck_e_parent = arm.edit_bones.new("MCH-rot_%s" % base_names[neck_e.name])
neck_e_parent.head = neck_e.head
neck_e_parent.tail = neck_e.head + ((mt.head_e.tail - mt.head_e.head).normalize() * neck_chain_segment_length / 2.0)
neck_e_parent.roll = neck_e.roll
neck_e_parent.roll = mt.head_e.roll
orig_parent = neck_e.parent
@ -220,10 +225,21 @@ def main(obj, bone_definition, base_names):
head_driver_path = mt.head_p.path_to_id()
# b01/max(0.001,b01+b02+b03+b04+b05)
target_names = [("b%.2d" % (i + 1)) for i in range(len(neck_chain))]
expression_suffix = "/max(0.001,%s)" % "+".join(target_names)
mt.head_p["bend_tot"] = 0.0
fcurve = mt.head_p.driver_add('["bend_tot"]', 0)
driver = fcurve.driver
driver.type = 'SUM'
fcurve.modifiers.remove(0) # grr dont need a modifier
for i in range(len(neck_chain)):
tar = driver.targets.new()
tar.name = target_names[i]
tar.id_type = 'OBJECT'
tar.id = obj
tar.rna_path = head_driver_path + ('["bend_%.2d"]' % (i + 1))
for i, attr in enumerate(mt_chain.attr_names):
neck_p = getattr(mt_chain, attr + "_p")
@ -252,16 +268,23 @@ def main(obj, bone_definition, base_names):
fcurve = con.driver_add("influence", 0)
driver = fcurve.driver
driver.type = 'SCRIPTED'
# b01/max(0.001,b01+b02+b03+b04+b05)
driver.expression = target_names[i] + expression_suffix
driver.expression = "bend/bend_tot"
fcurve.modifiers.remove(0) # grr dont need a modifier
for j in range(len(neck_chain)):
tar = driver.targets.new()
tar.name = target_names[j]
tar.id_type = 'OBJECT'
tar.id = obj
tar.rna_path = head_driver_path + ('["bend_%.2d"]' % (j + 1))
# add target
tar = driver.targets.new()
tar.name = "bend_tot"
tar.id_type = 'OBJECT'
tar.id = obj
tar.rna_path = head_driver_path + ('["bend_tot"]')
tar = driver.targets.new()
tar.name = "bend"
tar.id_type = 'OBJECT'
tar.id = obj
tar.rna_path = head_driver_path + ('["%s"]' % prop_name)
# no blending the result of this
return None

View File

@ -41,31 +41,31 @@ def metarig_template():
bone.roll = -3.1396
bone.connected = False
bone.parent = arm.edit_bones['hand']
bone = arm.edit_bones.new('palm.04')
bone = arm.edit_bones.new('palm.02')
bone.head[:] = 0.5000, -0.0000, 0.0000
bone.tail[:] = 0.6433, 1.2444, -0.1299
bone.roll = -3.1357
bone.connected = False
bone.parent = arm.edit_bones['hand']
bone = arm.edit_bones.new('palm.05')
bone = arm.edit_bones.new('palm.01')
bone.head[:] = 1.0000, 0.0000, 0.0000
bone.tail[:] = 1.3961, 1.0084, -0.1299
bone.roll = -3.1190
bone.connected = False
bone.parent = arm.edit_bones['hand']
bone = arm.edit_bones.new('palm.02')
bone = arm.edit_bones.new('palm.04')
bone.head[:] = -0.5000, 0.0000, -0.0000
bone.tail[:] = -0.5674, 1.2022, -0.1299
bone.roll = 3.1386
bone.connected = False
bone.parent = arm.edit_bones['hand']
bone = arm.edit_bones.new('palm.01')
bone = arm.edit_bones.new('palm.05')
bone.head[:] = -1.0000, 0.0000, -0.0000
bone.tail[:] = -1.3286, 1.0590, -0.1299
bone.roll = 3.1239
bone.connected = False
bone.parent = arm.edit_bones['hand']
bone = arm.edit_bones.new('palm.06')
bone = arm.edit_bones.new('thumb')
bone.head[:] = 1.3536, -0.2941, 0.0000
bone.tail[:] = 2.1109, 0.4807, -0.1299
bone.roll = -3.0929
@ -73,24 +73,25 @@ def metarig_template():
bone.parent = arm.edit_bones['hand']
bpy.ops.object.mode_set(mode='OBJECT')
pbone = obj.pose.bones['palm.05']
pbone = obj.pose.bones['palm.01']
pbone['type'] = 'palm'
def metarig_definition(obj, orig_bone_name):
'''
The bone given is the first in an array of siblings with a matching basename
sorted with the little finger lowest.
sorted with pointer first, little finger last.
eg.
[pinky, ring... etc]
[pointer, middle, ring, pinky... ] # any number of fingers
'''
arm = obj.data
palm_bone = arm.bones[orig_bone_name]
palm_parent = palm_bone.parent
palm_base = palm_bone.basename
bone_definition = [bone.name for bone in palm_parent.children if bone.basename == palm_base]
bone_definition.sort()
bone_definition.reverse()
return [palm_parent.name] + bone_definition

View File

@ -27,6 +27,7 @@ METARIG_NAMES = ("pelvis", "ribcage")
def metarig_template():
# generated by rigify.write_meta_rig
bpy.ops.object.mode_set(mode='EDIT')
obj = bpy.context.object
arm = obj.data
@ -86,7 +87,7 @@ def metarig_template():
bpy.ops.object.mode_set(mode='OBJECT')
pbone = obj.pose.bones['rib_cage']
pbone['type'] = 'spine'
pbone['type'] = 'spine.fk'
def metarig_definition(obj, orig_bone_name):
@ -110,7 +111,7 @@ def metarig_definition(obj, orig_bone_name):
raise Exception("expected the ribcage to have only 1 child.")
child = children[0]
bone_definition = [pelvis.name, ribcage.name, child.name]
bone_definition.extend([child.name for child in child.children_recursive_basename])
return bone_definition
@ -139,46 +140,54 @@ def main(obj, bone_definition, base_names):
child = spine_chain[0]
spine_chain_segment_length = child.length
child.parent = mt.pelvis_e # was mt.ribcage
#child.parent = mt.pelvis_e # was mt.ribcage
# The first bone in the chain happens to be the basis of others, create them now
ex = bone_class_instance(obj, ["pelvis", "ribcage", "ribcage_hinge", "spine_rotate"])
ex = bone_class_instance(obj, ["pelvis", "pelvis_copy", "ribcage", "ribcage_hinge", "ribcage_copy", "spine_rotate"])
df = bone_class_instance(obj, ["pelvis", "ribcage"]) # DEF-wgt_pelvis, DEF-wgt_rib_cage
ex.pelvis_copy_e = copy_bone_simple(arm, mt.pelvis, base_names[mt.pelvis]) # no parent
ex.pelvis_copy = ex.pelvis_copy_e.name
# copy the pelvis, offset to make MCH-spine_rotate and MCH-ribcage_hinge
ex.ribcage_hinge_e = copy_bone_simple(arm, mt.pelvis, "MCH-%s_hinge" % mt.ribcage)
ex.ribcage_hinge_e = copy_bone_simple(arm, mt.pelvis, "MCH-%s_hinge" % base_names[mt.ribcage])
ex.ribcage_hinge = ex.ribcage_hinge_e.name
ex.ribcage_hinge_e.translate(Vector(0.0, spine_chain_segment_length / 4.0, 0.0))
mt.ribcage_e.parent = ex.ribcage_hinge_e
ex.spine_rotate_e = copy_bone_simple(arm, mt.pelvis, "MCH-%s_rotate" % spine_chain_basename)
ex.spine_rotate = ex.spine_rotate_e.name
ex.spine_rotate_e.translate(Vector(0.0, spine_chain_segment_length / 2.0, 0.0))
# swap head/tail
ex.spine_rotate_e.head, ex.spine_rotate_e.tail = ex.spine_rotate_e.tail.copy(), ex.spine_rotate_e.head.copy()
ex.spine_rotate_e.parent = mt.pelvis_e
ex.spine_rotate_e.connected = False
ex.spine_rotate_e.parent = ex.pelvis_copy_e
df.pelvis_e = copy_bone_simple(arm, child.name, "DEF-wgt_%s" % mt.pelvis)
df.pelvis_e = copy_bone_simple(arm, child.name, "DEF-wgt_%s" % base_names[mt.pelvis])
df.pelvis = df.pelvis_e.name
df.pelvis_e.translate(Vector(spine_chain_segment_length * 2.0, - spine_chain_segment_length, 0.0))
ex.pelvis_e = copy_bone_simple(arm, child.name, "MCH-wgt_%s" % mt.pelvis)
ex.pelvis_e = copy_bone_simple(arm, child.name, "MCH-wgt_%s" % base_names[mt.pelvis])
ex.pelvis = ex.pelvis_e.name
ex.pelvis_e.translate(Vector(0.0, - spine_chain_segment_length, 0.0))
ex.pelvis_e.parent = mt.pelvis_e
ex.pelvis_e.connected = False
ex.pelvis_e.parent = ex.pelvis_copy_e
# Copy the last bone now
child = spine_chain[-1]
df.ribcage_e = copy_bone_simple(arm, child.name, "DEF-wgt_%s" % mt.ribcage)
df.ribcage_e = copy_bone_simple(arm, child.name, "DEF-wgt_%s" % base_names[mt.ribcage])
df.ribcage = df.ribcage_e.name
df.ribcage_e.translate(Vector(spine_chain_segment_length * 2.0, - df.ribcage_e.length / 2.0, 0.0))
ex.ribcage_copy_e = copy_bone_simple(arm, mt.ribcage, base_names[mt.ribcage])
ex.ribcage_copy = ex.ribcage_copy_e.name
ex.ribcage_copy_e.connected = False
ex.ribcage_copy_e.parent = ex.ribcage_hinge_e
ex.ribcage_e = copy_bone_simple(arm, child.name, "MCH-wgt_%s" % mt.ribcage)
ex.ribcage_e = copy_bone_simple(arm, child.name, "MCH-wgt_%s" % base_names[mt.ribcage])
ex.ribcage = ex.ribcage_e.name
ex.ribcage_e.translate(Vector(0.0, - ex.ribcage_e.length / 2.0, 0.0))
ex.ribcage_e.parent = mt.ribcage_e
ex.ribcage_e.parent = ex.ribcage_copy_e
spine_chain = [child.name for child in spine_chain]
@ -214,21 +223,22 @@ def main(obj, bone_definition, base_names):
# Now we need to re-parent these chains
for i, child_name in enumerate(spine_chain_orig):
attr = ex_chain.attr_names[i] + "_e"
ebone = getattr(ex_chain, attr)
if i == 0:
getattr(ex_chain, attr).parent = mt.pelvis_e
ebone.connected = False
ebone.parent = ex.pelvis_copy_e
else:
attr_parent = ex_chain.attr_names[i-1] + "_e"
getattr(ex_chain, attr).parent = getattr(ex_chain, attr_parent)
attr_parent = ex_chain.attr_names[i - 1] + "_e"
ebone.parent = getattr(ex_chain, attr_parent)
# intentional! get the parent from the other paralelle chain member
getattr(rv_chain, attr).parent = getattr(ex_chain, attr)
getattr(rv_chain, attr).parent = ebone
# ex_chain needs to interlace bones!
# Note, skip the first bone
for i in range(1, spine_chain_len): # similar to neck
child_name_orig = spine_chain_orig[i]
child_name_orig = base_names[spine_chain_orig[i]]
spine_e = getattr(mt_chain, mt_chain.attr_names[i] + "_e")
# dont store parent names, re-reference as each chain bones parent.
@ -284,6 +294,8 @@ def main(obj, bone_definition, base_names):
con.target_space = 'LOCAL'
# df.ribcage_p / DEF-wgt_rib_cage
df.ribcage_p.lock_location = True, True, True
con = df.ribcage_p.constraints.new('COPY_ROTATION')
con.target = obj
con.subtarget = ex.ribcage
@ -299,11 +311,9 @@ def main(obj, bone_definition, base_names):
con = ex.ribcage_hinge_p.constraints.new('COPY_ROTATION')
con.name = "hinge"
con.target = obj
con.subtarget = mt.pelvis
con.subtarget = ex.pelvis_copy
# add driver
hinge_driver_path = mt.ribcage_p.path_to_id() + '["hinge"]'
fcurve = con.driver_add("influence", 0)
driver = fcurve.driver
tar = driver.targets.new()
@ -311,7 +321,7 @@ def main(obj, bone_definition, base_names):
tar.name = "var"
tar.id_type = 'OBJECT'
tar.id = obj
tar.rna_path = hinge_driver_path
tar.rna_path = ex.ribcage_copy_p.path_to_id() + '["hinge"]'
mod = fcurve.modifiers[0]
mod.poly_order = 1
@ -321,7 +331,7 @@ def main(obj, bone_definition, base_names):
con = ex.spine_rotate_p.constraints.new('COPY_ROTATION')
con.target = obj
con.subtarget = mt.ribcage
con.subtarget = ex.ribcage_copy
# ex.pelvis_p / MCH-wgt_pelvis
@ -347,29 +357,23 @@ def main(obj, bone_definition, base_names):
con.target = obj
con.subtarget = getattr(mt_chain, mt_chain.attr_names[-1])
# mt.pelvis_p / rib_cage
con = mt.ribcage_p.constraints.new('COPY_LOCATION')
# ex.pelvis_copy_p / rib_cage
con = ex.ribcage_copy_p.constraints.new('COPY_LOCATION')
con.target = obj
con.subtarget = mt.pelvis
con.subtarget = ex.pelvis_copy
con.head_tail = 0.0
# This stores all important ID props
prop = rna_idprop_ui_prop_get(mt.ribcage_p, "hinge", create=True)
mt.ribcage_p["hinge"] = 1.0
prop = rna_idprop_ui_prop_get(ex.ribcage_copy_p, "hinge", create=True)
ex.ribcage_copy_p["hinge"] = 1.0
prop["soft_min"] = 0.0
prop["soft_max"] = 1.0
prop = rna_idprop_ui_prop_get(mt.ribcage_p, "pivot_slide", create=True)
mt.ribcage_p["pivot_slide"] = 0.5
prop = rna_idprop_ui_prop_get(ex.ribcage_copy_p, "pivot_slide", create=True)
ex.ribcage_copy_p["pivot_slide"] = 1.0 / spine_chain_len
prop["soft_min"] = 1.0 / spine_chain_len
prop["soft_max"] = 1.0
for i in range(spine_chain_len - 1):
prop_name = "bend_%.2d" % (i + 1)
prop = rna_idprop_ui_prop_get(mt.ribcage_p, prop_name, create=True)
mt.ribcage_p[prop_name] = 1.0
prop["soft_min"] = 0.0
prop["soft_max"] = 1.0
# Create a fake connected parent/child relationship with bone location constraints
# positioned at the tip.
@ -387,15 +391,31 @@ def main(obj, bone_definition, base_names):
# Constrain 'inbetween' bones
# b01/max(0.001,b01+b02+b03+b04+b05)
target_names = [("b%.2d" % (i + 1)) for i in range(spine_chain_len - 1)]
expression_suffix = "/max(0.001,%s)" % "+".join(target_names)
rib_driver_path = ex.ribcage_copy_p.path_to_id()
rib_driver_path = mt.ribcage_p.path_to_id()
ex.ribcage_copy_p["bend_tot"] = 0.0
fcurve = ex.ribcage_copy_p.driver_add('["bend_tot"]', 0)
driver = fcurve.driver
driver.type = 'SUM'
fcurve.modifiers.remove(0) # grr dont need a modifier
for i in range(spine_chain_len - 1):
tar = driver.targets.new()
tar.name = target_names[i]
tar.id_type = 'OBJECT'
tar.id = obj
tar.rna_path = rib_driver_path + ('["bend_%.2d"]' % (i + 1))
for i in range(1, spine_chain_len):
# Add bend prop
prop_name = "bend_%.2d" % i
prop = rna_idprop_ui_prop_get(ex.ribcage_copy_p, prop_name, create=True)
ex.ribcage_copy_p[prop_name] = 1.0
prop["soft_min"] = 0.0
prop["soft_max"] = 1.0
spine_p = getattr(ex_chain, ex_chain.attr_names[i] + "_p")
spine_p_parent = spine_p.parent # interlaced bone
@ -410,16 +430,24 @@ def main(obj, bone_definition, base_names):
fcurve = con.driver_add("influence", 0)
driver = fcurve.driver
driver.type = 'SCRIPTED'
# b01/max(0.001,b01+b02+b03+b04+b05)
driver.expression = target_names[i - 1] + expression_suffix
driver.expression = "bend/bend_tot"
fcurve.modifiers.remove(0) # grr dont need a modifier
for j in range(spine_chain_len - 1):
tar = driver.targets.new()
tar.name = target_names[j]
tar.id_type = 'OBJECT'
tar.id = obj
tar.rna_path = rib_driver_path + ('["bend_%.2d"]' % (j + 1))
# add target
tar = driver.targets.new()
tar.name = "bend_tot"
tar.id_type = 'OBJECT'
tar.id = obj
tar.rna_path = rib_driver_path + ('["bend_tot"]')
tar = driver.targets.new()
tar.name = "bend"
tar.id_type = 'OBJECT'
tar.id = obj
tar.rna_path = rib_driver_path + ('["%s"]' % prop_name)
# original bone drivers

View File

@ -217,7 +217,7 @@ class WM_OT_properties_edit(bpy.types.Operator):
wm.invoke_props_popup(self, event)
return ('RUNNING_MODAL',)
class WM_OT_properties_add(bpy.types.Operator):

View File

@ -0,0 +1,191 @@
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
# ##### END GPL LICENSE BLOCK #####
import bpy
class DOPESHEET_HT_header(bpy.types.Header):
bl_space_type = 'DOPESHEET_EDITOR'
def draw(self, context):
layout = self.layout
st = context.space_data
row = layout.row(align=True)
row.template_header()
if context.area.show_menus:
sub = row.row(align=True)
sub.menu("DOPESHEET_MT_view")
sub.menu("DOPESHEET_MT_select")
if st.mode == 'DOPESHEET' or (st.mode == 'ACTION' and st.action != None):
sub.menu("DOPESHEET_MT_channel")
elif st.mode == 'GPENCIL':
# gpencil Channel menu
pass
if st.mode != 'GPENCIL':
sub.menu("DOPESHEET_MT_key")
layout.prop(st, "mode", text="")
layout.prop(st.dopesheet, "display_summary", text="Summary")
if st.mode == 'DOPESHEET':
layout.template_dopesheet_filter(st.dopesheet)
elif st.mode == 'ACTION':
layout.template_ID(st, "action", new="action.new")
if st.mode != 'GPENCIL':
layout.prop(st, "autosnap", text="")
row = layout.row(align=True)
row.operator("action.copy", text="", icon='ICON_COPYDOWN')
row.operator("action.paste", text="", icon='ICON_PASTEDOWN')
class DOPESHEET_MT_view(bpy.types.Menu):
bl_label = "View"
def draw(self, context):
layout = self.layout
st = context.space_data
layout.column()
layout.prop(st, "show_cframe_indicator")
layout.prop(st, "show_sliders")
layout.prop(st, "automerge_keyframes")
if st.show_seconds:
layout.operator("anim.time_toggle", text="Show Frames")
else:
layout.operator("anim.time_toggle", text="Show Seconds")
layout.separator()
layout.operator("anim.previewrange_set")
layout.operator("anim.previewrange_clear")
layout.operator("action.previewrange_set")
layout.separator()
layout.operator("action.frame_jump")
layout.operator("action.view_all")
layout.separator()
layout.operator("screen.area_dupli")
layout.operator("screen.screen_full_area")
class DOPESHEET_MT_select(bpy.types.Menu):
bl_label = "Select"
def draw(self, context):
layout = self.layout
layout.column()
# This is a bit misleading as the operator's default text is "Select All" while it actually *toggles* All/None
layout.operator("action.select_all_toggle")
layout.operator("action.select_all_toggle", text="Invert Selection").invert = True
layout.separator()
layout.operator("action.select_border")
layout.operator("action.select_border", text="Border Axis Range").axis_range = True
layout.separator()
layout.operator("action.select_column", text="Columns on Selected Keys").mode = 'KEYS'
layout.operator("action.select_column", text="Column on Current Frame").mode = 'CFRA'
layout.operator("action.select_column", text="Columns on Selected Markers").mode = 'MARKERS_COLUMN'
layout.operator("action.select_column", text="Between Selected Markers").mode = 'MARKERS_BETWEEN'
class DOPESHEET_MT_channel(bpy.types.Menu):
bl_label = "Channel"
def draw(self, context):
layout = self.layout
layout.column()
layout.operator("anim.channels_setting_toggle")
layout.operator("anim.channels_setting_enable")
layout.operator("anim.channels_setting_disable")
layout.separator()
layout.operator("anim.channels_editable_toggle")
layout.separator()
layout.operator("anim.channels_expand")
layout.operator("anim.channels_collapse")
class DOPESHEET_MT_key(bpy.types.Menu):
bl_label = "Key"
def draw(self, context):
layout = self.layout
layout.column()
layout.menu("DOPESHEET_MT_key_transform", text="Transform")
layout.operator_menu_enum("action.snap", property="type", text="Snap")
layout.operator_menu_enum("action.mirror", property="type", text="Mirror")
layout.separator()
# Inconsistent naming? act/action
layout.operator("act.keyframe_insert")
layout.separator()
layout.operator("action.duplicate")
layout.operator("action.delete")
layout.separator()
layout.operator_menu_enum("action.keyframe_type", property="type", text="Keyframe Type")
layout.operator_menu_enum("action.handle_type", property="type", text="Handle Type")
layout.operator_menu_enum("action.interpolation_type", property="type", text="Interpolation Mode")
layout.operator_menu_enum("action.extrapolation_type", property="type", text="Extrapolation Mode")
layout.separator()
layout.operator("action.clean")
layout.operator("action.sample")
layout.separator()
layout.operator("action.copy")
layout.operator("action.paste")
class DOPESHEET_MT_key_transform(bpy.types.Menu):
bl_label = "Transform"
def draw(self, context):
layout = self.layout
layout.column()
layout.operator("tfm.translate", text="Grab/Move")
layout.operator("tfm.transform", text="Extend").mode = 'TIME_EXTEND'
layout.operator("tfm.resize", text="Scale")
bpy.types.register(DOPESHEET_HT_header) # header/menu classes
bpy.types.register(DOPESHEET_MT_view)
bpy.types.register(DOPESHEET_MT_select)
bpy.types.register(DOPESHEET_MT_channel)
bpy.types.register(DOPESHEET_MT_key)
bpy.types.register(DOPESHEET_MT_key_transform)

View File

@ -16,7 +16,6 @@
#
# ##### END GPL LICENSE BLOCK #####
# <pep8 compliant>
import bpy
@ -51,9 +50,10 @@ class GRAPH_HT_header(bpy.types.Header):
row.operator("graph.paste", text="", icon='ICON_PASTEDOWN')
row = layout.row(align=True)
# these likely need new icons
row.operator("graph.ghost_curves_create", text="", icon='ICON_GHOST_ENABLED')
row.operator("graph.ghost_curves_clear", text="", icon='ICON_GHOST_DISABLED')
if st.has_ghost_curves:
row.operator("graph.ghost_curves_clear", text="", icon='ICON_GHOST_DISABLED')
else:
row.operator("graph.ghost_curves_create", text="", icon='ICON_GHOST_ENABLED')
class GRAPH_MT_view(bpy.types.Menu):
@ -67,7 +67,7 @@ class GRAPH_MT_view(bpy.types.Menu):
layout.column()
layout.separator()
layout.operator("graph.properties")
layout.operator("graph.properties", icon="ICON_MENU_PANEL")
layout.prop(st, "show_cframe_indicator")
layout.prop(st, "show_cursor")
@ -75,7 +75,10 @@ class GRAPH_MT_view(bpy.types.Menu):
layout.prop(st, "automerge_keyframes")
layout.separator()
layout.operator("graph.handles_view_toggle")
if st.show_handles:
layout.operator("graph.handles_view_toggle", icon="ICON_CHECKBOX_HLT", text="Show All Handles")
else:
layout.operator("graph.handles_view_toggle", icon="ICON_CHECKBOX_DEHLT", text="Show All Handles")
layout.prop(st, "only_selected_curves_handles")
layout.prop(st, "only_selected_keyframe_handles")
layout.operator("anim.time_toggle")

View File

@ -29,6 +29,7 @@ class INFO_HT_header(bpy.types.Header):
def draw(self, context):
layout = self.layout
window = context.window
scene = context.scene
rd = scene.render_data
@ -45,7 +46,12 @@ class INFO_HT_header(bpy.types.Header):
sub.menu("INFO_MT_render")
sub.menu("INFO_MT_help")
layout.template_ID(context.window, "screen", new="screen.new", unlink="screen.delete")
if window.screen.fullscreen:
layout.operator("screen.back_to_previous", icon="ICON_SCREEN_BACK", text="Back to Previous")
layout.separator()
else:
layout.template_ID(context.window, "screen", new="screen.new", unlink="screen.delete")
layout.template_ID(context.screen, "scene", new="scene.new", unlink="scene.delete")
layout.separator()
@ -79,7 +85,7 @@ class INFO_MT_file(bpy.types.Menu):
layout.separator()
layout.operator_context = 'EXEC_AREA'
layout.operator_context = 'INVOKE_AREA'
layout.operator("wm.save_mainfile", text="Save", icon='ICON_FILE_TICK')
layout.operator_context = 'INVOKE_AREA'
layout.operator("wm.save_as_mainfile", text="Save As...")

View File

@ -0,0 +1,166 @@
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
# ##### END GPL LICENSE BLOCK #####
import bpy
class NLA_HT_header(bpy.types.Header):
bl_space_type = 'NLA_EDITOR'
def draw(self, context):
layout = self.layout
st = context.space_data
row = layout.row(align=True)
row.template_header()
if context.area.show_menus:
sub = row.row(align=True)
sub.menu("NLA_MT_view")
sub.menu("NLA_MT_select")
sub.menu("NLA_MT_edit")
sub.menu("NLA_MT_add")
layout.template_dopesheet_filter(st.dopesheet)
layout.prop(st, "autosnap", text="")
class NLA_MT_view(bpy.types.Menu):
bl_label = "View"
def draw(self, context):
layout = self.layout
st = context.space_data
layout.column()
layout.operator("nla.properties", icon="ICON_MENU_PANEL")
layout.separator()
layout.prop(st, "show_cframe_indicator")
if st.show_seconds:
layout.operator("anim.time_toggle", text="Show Frames")
else:
layout.operator("anim.time_toggle", text="Show Seconds")
layout.prop(st, "show_strip_curves")
layout.separator()
layout.operator("anim.previewrange_set")
layout.operator("anim.previewrange_clear")
layout.separator()
layout.operator("screen.area_dupli")
layout.operator("screen.screen_full_area")
class NLA_MT_select(bpy.types.Menu):
bl_label = "Select"
def draw(self, context):
layout = self.layout
layout.column()
# This is a bit misleading as the operator's default text is "Select All" while it actually *toggles* All/None
layout.operator("nla.select_all_toggle")
layout.operator("nla.select_all_toggle", text="Invert Selection").invert = True
layout.separator()
layout.operator("nla.select_border")
layout.operator("nla.select_border", text="Border Axis Range").axis_range = True
class NLA_MT_edit(bpy.types.Menu):
bl_label = "Edit"
def draw(self, context):
layout = self.layout
scene = context.scene
layout.column()
layout.menu("NLA_MT_edit_transform", text="Transform")
layout.operator_menu_enum("nla.snap", property="type", text="Snap")
layout.separator()
layout.operator("nla.duplicate")
layout.operator("nla.split")
layout.operator("nla.delete")
layout.separator()
layout.operator("nla.mute_toggle")
layout.separator()
layout.operator("nla.apply_scale")
layout.operator("nla.clear_scale")
layout.separator()
layout.operator("nla.move_up")
layout.operator("nla.move_down")
layout.separator()
# TODO: names of these tools for 'tweakmode' need changing?
if scene.nla_tweakmode_on:
layout.operator("nla.tweakmode_exit", text="Stop Tweaking Strip Actions")
else:
layout.operator("nla.tweakmode_enter", text="Start Tweaking Strip Actions")
class NLA_MT_add(bpy.types.Menu):
bl_label = "Add"
def draw(self, context):
layout = self.layout
layout.column()
layout.operator("nla.actionclip_add")
layout.operator("nla.transition_add")
layout.separator()
layout.operator("nla.meta_add")
layout.operator("nla.meta_remove")
layout.separator()
layout.operator("nla.tracks_add")
layout.operator("nla.tracks_add", text="Add Tracks Above Selected").above_selected = True
class NLA_MT_edit_transform(bpy.types.Menu):
bl_label = "Transform"
def draw(self, context):
layout = self.layout
layout.column()
layout.operator("tfm.translate", text="Grab/Move")
layout.operator("tfm.transform", text="Extend").mode = 'TIME_EXTEND'
layout.operator("tfm.resize", text="Scale")
bpy.types.register(NLA_HT_header) # header/menu classes
bpy.types.register(NLA_MT_view)
bpy.types.register(NLA_MT_select)
bpy.types.register(NLA_MT_edit)
bpy.types.register(NLA_MT_add)
bpy.types.register(NLA_MT_edit_transform)

View File

@ -178,6 +178,7 @@ class SEQUENCER_MT_add_effect(bpy.types.Menu):
layout.operator("sequencer.effect_strip_add", text="Subtract").type = 'SUBTRACT'
layout.operator("sequencer.effect_strip_add", text="Alpha Over").type = 'ALPHA_OVER'
layout.operator("sequencer.effect_strip_add", text="Alpha Under").type = 'ALPHA_UNDER'
layout.operator("sequencer.effect_strip_add", text="Cross").type = 'CROSS'
layout.operator("sequencer.effect_strip_add", text="Gamma Cross").type = 'GAMMA_CROSS'
layout.operator("sequencer.effect_strip_add", text="Multiply").type = 'MULTIPLY'
layout.operator("sequencer.effect_strip_add", text="Over Drop").type = 'OVER_DROP'
@ -222,7 +223,7 @@ class SEQUENCER_MT_strip(bpy.types.Menu):
layout.operator("sequencer.effect_reassign_inputs")
elif stype == 'IMAGE':
layout.separator()
layout.operator("sequencer.image_change")
# layout.operator("sequencer.image_change")
layout.operator("sequencer.rendersize")
elif stype == 'SCENE':
layout.separator()
@ -338,7 +339,7 @@ class SEQUENCER_PT_effect(SequencerButtonsPanel):
return False
return strip.type in ('ADD', 'SUBTRACT', 'ALPHA_OVER', 'ALPHA_UNDER',
'GAMMA_CROSS', 'MULTIPLY', 'OVER_DROP',
'CROSS', 'GAMMA_CROSS', 'MULTIPLY', 'OVER_DROP',
'PLUGIN',
'WIPE', 'GLOW', 'TRANSFORM', 'COLOR', 'SPEED')

File diff suppressed because it is too large Load Diff

View File

@ -50,7 +50,7 @@ class VIEW3D_HT_header(bpy.types.Header):
if edit_object:
sub.menu("VIEW3D_MT_edit_%s" % edit_object.type.lower())
elif obj:
if mode_string not in ('PAINT_WEIGHT'):
if mode_string not in ('PAINT_WEIGHT', 'PAINT_TEXTURE'):
sub.menu("VIEW3D_MT_%s" % mode_string.lower())
else:
sub.menu("VIEW3D_MT_object")
@ -293,8 +293,8 @@ class VIEW3D_MT_view_navigation(bpy.types.Menu):
layout.separator()
layout.operator("view3d.zoom", text="Zoom In").delta = 1.0
layout.operator("view3d.zoom", text="Zoom Out").delta = -1.0
layout.operator("view3d.zoom", text="Zoom In").delta = 1
layout.operator("view3d.zoom", text="Zoom Out").delta = -1
layout.separator()

View File

@ -280,7 +280,7 @@ void modifier_copyData(struct ModifierData *md, struct ModifierData *ta
int modifier_dependsOnTime(struct ModifierData *md);
int modifier_supportsMapping(struct ModifierData *md);
int modifier_couldBeCage(struct ModifierData *md);
int modifier_isDeformer(struct ModifierData *md);
int modifier_isCorrectableDeformed(struct ModifierData *md);
int modifier_sameTopology(ModifierData *md);
int modifier_isEnabled(struct ModifierData *md, int required_mode);
void modifier_setError(struct ModifierData *md, char *format, ...);
@ -303,7 +303,7 @@ int modifiers_isParticleEnabled(struct Object *ob);
struct Object *modifiers_isDeformedByArmature(struct Object *ob);
struct Object *modifiers_isDeformedByLattice(struct Object *ob);
int modifiers_usesArmature(struct Object *ob, struct bArmature *arm);
int modifiers_isDeformed(struct Scene *scene, struct Object *ob);
int modifiers_isCorrectableDeformed(struct Scene *scene, struct Object *ob);
void modifier_freeTemporaryData(struct ModifierData *md);
int modifiers_indexInObject(struct Object *ob, struct ModifierData *md);

View File

@ -186,6 +186,7 @@ int shuffle_seq_time(ListBase * seqbasep);
void free_imbuf_seq(struct Scene *scene, struct ListBase * seqbasep, int check_mem_usage);
void seq_update_sound(struct Sequence *seq);
void seq_update_muting(struct Editing *ed);
void clear_scene_in_allseqs(struct Scene *sce);

View File

@ -41,6 +41,8 @@ void sound_init();
void sound_exit();
void sound_disable();
struct bSound* sound_new_file(struct Main *main, char* filename);
// XXX unused currently

View File

@ -2513,7 +2513,7 @@ int editmesh_get_first_deform_matrices(Object *ob, EditMesh *em, float (**deform
}
for(; md && i <= cageIndex; md = md->next, i++)
if(editmesh_modifier_is_enabled(md, dm) && modifier_isDeformer(md))
if(editmesh_modifier_is_enabled(md, dm) && modifier_isCorrectableDeformed(md))
numleft++;
if(dm)

View File

@ -758,7 +758,12 @@ void fcurve_free_driver(FCurve *fcu)
dtarn= dtar->next;
driver_free_target(driver, dtar);
}
#ifndef DISABLE_PYTHON
if(driver->expr_comp)
BPY_DECREF(driver->expr_comp);
#endif
/* free driver itself, then set F-Curve's point to this to NULL (as the curve may still be used) */
MEM_freeN(driver);
fcu->driver= NULL;
@ -910,6 +915,7 @@ static float evaluate_driver (ChannelDriver *driver, float evaltime)
// TODO: the flags for individual targets need to be used too for more fine-grained support...
switch (driver->type) {
case DRIVER_TYPE_AVERAGE: /* average values of driver targets */
case DRIVER_TYPE_SUM: /* sum values of driver targets */
{
/* check how many targets there are first (i.e. just one?) */
if (driver->targets.first == driver->targets.last) {
@ -921,19 +927,22 @@ static float evaluate_driver (ChannelDriver *driver, float evaltime)
/* more than one target, so average the values of the targets */
int tot = 0;
float value = 0.0f;
/* loop through targets, adding (hopefully we don't get any overflow!) */
for (dtar= driver->targets.first; dtar; dtar=dtar->next) {
value += driver_get_target_value(driver, dtar);
value += driver_get_target_value(driver, dtar);
tot++;
}
/* return the average of these */
return (value / (float)tot);
if(driver->type == DRIVER_TYPE_AVERAGE)
return (value / (float)tot);
else
return value;
}
}
break;
case DRIVER_TYPE_PYTHON: /* expression */
{
#ifndef DISABLE_PYTHON

View File

@ -217,8 +217,8 @@ static int rem_from_group_internal(Group *group, Object *ob)
int rem_from_group(Group *group, Object *object, Scene *scene, Base *base)
{
if(rem_from_group_internal(group, object)) {
if(find_group(object, NULL) == NULL) {
/* object can be NULL */
if(object && find_group(object, NULL) == NULL) {
if(scene && base==NULL)
base= object_in_scene(object, scene);

View File

@ -9156,15 +9156,15 @@ Object *modifiers_isDeformedByArmature(Object *ob)
}
/* Takes an object and returns its first selected lattice, else just its
* armature
* This should work for multiple armatures per object
* lattice
* This should work for multiple lattics per object
*/
Object *modifiers_isDeformedByLattice(Object *ob)
{
ModifierData *md = modifiers_getVirtualModifierList(ob);
LatticeModifierData *lmd= NULL;
/* return the first selected armature, this lets us use multiple armatures
/* return the first selected lattice, this lets us use multiple lattices
*/
for (; md; md=md->next) {
if (md->type==eModifierType_Lattice) {
@ -9197,28 +9197,24 @@ int modifiers_usesArmature(Object *ob, bArmature *arm)
return 0;
}
int modifier_isDeformer(ModifierData *md)
int modifier_isCorrectableDeformed(ModifierData *md)
{
if (md->type==eModifierType_Armature)
return 1;
if (md->type==eModifierType_Curve)
return 1;
if (md->type==eModifierType_Lattice)
return 1;
if (md->type==eModifierType_ShapeKey)
return 1;
return 0;
}
int modifiers_isDeformed(Scene *scene, Object *ob)
int modifiers_isCorrectableDeformed(Scene *scene, Object *ob)
{
ModifierData *md = modifiers_getVirtualModifierList(ob);
for (; md; md=md->next) {
if(ob->mode==OB_MODE_EDIT && (md->mode & eModifierMode_Editmode)==0);
else
if(modifier_isDeformer(md))
if(modifier_isCorrectableDeformed(md))
return 1;
}
return 0;

View File

@ -733,12 +733,12 @@ float dof_camera(Object *ob)
if (cam->dof_ob) {
/* too simple, better to return the distance on the view axis only
* return len_v3v3(ob->obmat[3], cam->dof_ob->obmat[3]); */
float mat[4][4], obmat[4][4];
float mat[4][4], imat[4][4], obmat[4][4];
copy_m4_m4(obmat, ob->obmat);
normalize_m4(obmat);
invert_m4_m4(ob->imat, obmat);
mul_m4_m4m4(mat, cam->dof_ob->obmat, ob->imat);
invert_m4_m4(imat, obmat);
mul_m4_m4m4(mat, cam->dof_ob->obmat, imat);
return (float)fabs(mat[3][2]);
}
return cam->YF_dofdist;

View File

@ -3477,16 +3477,55 @@ int shuffle_seq_time(ListBase * seqbasep)
return offset? 0:1;
}
void seq_update_sound(struct Sequence *seq)
void seq_update_sound(Sequence *seq)
{
if(seq->type == SEQ_SOUND)
if(seq->type == SEQ_SOUND && seq->sound_handle)
{
seq->sound_handle->startframe = seq->startdisp;
seq->sound_handle->endframe = seq->enddisp;
seq->sound_handle->frameskip = seq->startofs + seq->anim_startofs;
seq->sound_handle->mute = seq->flag & SEQ_MUTE ? 1 : 0;
seq->sound_handle->changed = -1;
/* mute is set in seq_update_muting_recursive */
}
}
static void seq_update_muting_recursive(ListBase *seqbasep, Sequence *metaseq, int mute)
{
Sequence *seq;
int seqmute;
/* for sound we go over full meta tree to update muted state,
since sound is played outside of evaluating the imbufs, */
for(seq=seqbasep->first; seq; seq=seq->next) {
seqmute= (mute || (seq->flag & SEQ_MUTE));
if(seq->type == SEQ_META) {
/* if this is the current meta sequence, unmute because
all sequences above this were set to mute */
if(seq == metaseq)
seqmute= 0;
seq_update_muting_recursive(&seq->seqbase, metaseq, seqmute);
}
else if(seq->type == SEQ_SOUND) {
if(seq->sound_handle && seqmute != seq->sound_handle->mute) {
seq->sound_handle->mute = seqmute;
seq->sound_handle->changed = -1;
}
}
}
}
void seq_update_muting(Editing *ed)
{
if(ed) {
/* mute all sounds up to current metastack list */
MetaStack *ms= ed->metastack.last;
if(ms)
seq_update_muting_recursive(&ed->seqbase, ms->parseq, 1);
else
seq_update_muting_recursive(&ed->seqbase, NULL, 0);
}
}

View File

@ -31,6 +31,13 @@
#include <config.h>
#endif
static int sound_disabled = 0;
void sound_disable()
{
sound_disabled = 1;
}
void sound_init()
{
AUD_Specs specs;
@ -42,6 +49,9 @@ void sound_init()
specs.format = U.audioformat;
specs.rate = U.audiorate;
if (sound_disabled)
device = 0;
if(buffersize < 128)
buffersize = AUD_DEFAULT_BUFFER_SIZE;

View File

@ -4232,6 +4232,9 @@ static void lib_link_scene(FileData *fd, Main *main)
seq->anim= 0;
}
SEQ_END
if(sce->ed)
seq_update_muting(sce->ed);
if(sce->nodetree) {
lib_link_ntree(fd, &sce->id, sce->nodetree);
@ -10164,6 +10167,14 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
}
}
/* clear hanging 'temp' screens from older 2.5 files*/
if (main->versionfile == 250) {
bScreen *screen;
for(screen= main->screen.first; screen; screen= screen->id.next) {
if (screen->full == SCREENTEMP)
free_libblock(&main->screen, screen);
}
}
}
/* put 2.50 compatibility code here until next subversion bump */

View File

@ -934,8 +934,14 @@ static void write_fcurves(WriteData *wd, ListBase *fcurves)
ChannelDriver *driver= fcu->driver;
DriverTarget *dtar;
/* don't save compiled python bytecode */
void *expr_comp= driver->expr_comp;
driver->expr_comp= NULL;
writestruct(wd, DATA, "ChannelDriver", 1, driver);
driver->expr_comp= expr_comp; /* restore */
/* targets */
for (dtar= driver->targets.first; dtar; dtar= dtar->next) {
writestruct(wd, DATA, "DriverTarget", 1, dtar);

View File

@ -32,6 +32,7 @@
#include "MEM_guardedalloc.h"
#include "DNA_action_types.h"
#include "DNA_anim_types.h"
#include "DNA_armature_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
@ -39,8 +40,10 @@
#include "BLI_blenlib.h"
#include "BKE_action.h"
#include "BKE_animsys.h"
#include "BKE_context.h"
#include "BKE_depsgraph.h"
#include "BKE_global.h"
#include "BKE_main.h"
#include "BKE_scene.h"
#include "BKE_screen.h"
@ -55,6 +58,61 @@
#include "WM_api.h"
#include "WM_types.h"
/* tags the given anim list element for refreshes (if applicable)
* due to Animation Editor editing */
void ANIM_list_elem_update(Scene *scene, bAnimListElem *ale)
{
ID *id;
FCurve *fcu;
AnimData *adt;
id= ale->id;
if(!id)
return;
/* tag AnimData for refresh so that other views will update in realtime with these changes */
adt= BKE_animdata_from_id(id);
if(adt)
adt->recalc |= ADT_RECALC_ANIM;
/* update data */
fcu= (ale->datatype == ALE_FCURVE)? ale->key_data: NULL;
if(fcu && fcu->rna_path) {
/* if we have an fcurve, call the update for the property we
are editing, this is then expected to do the proper redraws
and depsgraph updates */
PointerRNA id_ptr, ptr;
PropertyRNA *prop;
RNA_id_pointer_create(id, &id_ptr);
if(RNA_path_resolve(&id_ptr, fcu->rna_path, &ptr, &prop))
RNA_property_update_main(G.main, scene, &ptr, prop);
}
else {
/* in other case we do standard depsgaph update, ideally
we'd be calling property update functions here too ... */
DAG_id_flush_update(id, OB_RECALC); // XXX or do we want something more restrictive?
}
}
/* tags the given ID block for refreshes (if applicable) due to
* Animation Editor editing */
void ANIM_id_update(Scene *scene, ID *id)
{
if(id) {
AnimData *adt= BKE_animdata_from_id(id);
/* tag AnimData for refresh so that other views will update in realtime with these changes */
if (adt)
adt->recalc |= ADT_RECALC_ANIM;
/* set recalc flags */
DAG_id_flush_update(id, OB_RECALC); // XXX or do we want something more restrictive?
}
}
/* **************************** pose <-> action syncing ******************************** */
/* Summary of what needs to be synced between poses and actions:
* 1) Flags

View File

@ -231,7 +231,8 @@ static void nupdate_abk_bezt (void *node, void *data)
// TODO: need to allocate new array to cater...
// FIXME: urgent... is a problem when working with duplicate keyframes
//bezts_extra= MEM_callocN(...);
printf("FIXME: nupdate_abk_bezt() missing case for too many overlapping BezTriples \n");
if(G.f & G_DEBUG)
printf("FIXME: nupdate_abk_bezt() missing case for too many overlapping BezTriples \n");
}
else {
/* just store an extra one */

File diff suppressed because it is too large Load Diff

View File

@ -496,6 +496,9 @@ void ED_nla_postop_refresh(bAnimContext *ac);
/* --------- anim_deps.c, animation updates -------- */
void ANIM_id_update(struct Scene *scene, struct ID *id);
void ANIM_list_elem_update(struct Scene *scene, bAnimListElem *ale);
/* pose <-> action syncing */
void ANIM_action_to_pose_sync(struct Object *ob);
void ANIM_pose_to_action_sync(struct Object *ob, struct ScrArea *sa);

View File

@ -27,22 +27,23 @@
#ifndef ED_ARMATURE_H
#define ED_ARMATURE_H
struct bContext;
struct Scene;
struct Object;
struct Base;
struct Bone;
struct bArmature;
struct Base;
struct bContext;
struct Bone;
struct bPoseChannel;
struct wmOperator;
struct wmKeyConfig;
struct DerivedMesh;
struct IDProperty;
struct ListBase;
struct MeshDeformModifierData;
struct Object;
struct RegionView3D;
struct Scene;
struct SK_Sketch;
struct View3D;
struct ViewContext;
struct RegionView3D;
struct SK_Sketch;
struct IDProperty;
struct MeshDeformModifierData;
struct wmKeyConfig;
struct wmOperator;
typedef struct EditBone
{

View File

@ -81,7 +81,7 @@ void ED_area_tag_refresh(ScrArea *sa);
void ED_area_do_refresh(struct bContext *C, ScrArea *sa);
void ED_area_headerprint(ScrArea *sa, const char *str);
void ED_area_newspace(struct bContext *C, ScrArea *sa, int type);
void ED_area_prevspace(struct bContext *C);
void ED_area_prevspace(struct bContext *C, ScrArea *sa);
void ED_area_swapspace(struct bContext *C, ScrArea *sa1, ScrArea *sa2);
/* screens */
@ -98,9 +98,10 @@ void ED_screen_delete_scene(struct bContext *C, struct Scene *scene);
void ED_screen_set_subwinactive(struct wmWindow *win, struct wmEvent *event);
void ED_screen_exit(struct bContext *C, struct wmWindow *window, struct bScreen *screen);
void ED_screen_animation_timer(struct bContext *C, int redraws, int sync, int enable);
void ED_screen_animation_timer_update(struct bContext *C, int redraws);
void ED_screen_animation_timer_update(struct bScreen *screen, int redraws);
int ED_screen_full_newspace(struct bContext *C, ScrArea *sa, int type);
void ED_screen_full_prevspace(struct bContext *C);
void ED_screen_full_prevspace(struct bContext *C, ScrArea *sa);
void ED_screen_full_restore(struct bContext *C, ScrArea *sa);
void ED_screen_new_window(struct bContext *C, struct rcti *position, int type);

View File

@ -76,7 +76,7 @@ DEF_ICON(ICON_UNLOCKED)
DEF_ICON(ICON_LOCKED)
DEF_ICON(ICON_UNPINNED)
DEF_ICON(ICON_PINNED)
DEF_ICON(ICON_BLANK015)
DEF_ICON(ICON_SCREEN_BACK)
DEF_ICON(ICON_RIGHTARROW)
DEF_ICON(ICON_DOWNARROW_HLT)
DEF_ICON(ICON_DOTSUP)

View File

@ -3405,7 +3405,8 @@ static int ui_but_menu(bContext *C, uiBut *but)
if((but->rnapoin.data && but->rnaprop)==0 && but->optype==NULL)
return 0;
button_timers_tooltip_remove(C, but);
if(but->rnaprop)
name= (char*)RNA_property_ui_name(but->rnaprop);
@ -3604,7 +3605,7 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, wmEvent *event)
char buf[512];
if(WM_key_event_operator_string(C, but->optype->idname, but->opcontext, prop, buf, sizeof(buf))) {
button_timers_tooltip_remove(C, but);
uiPupBlock(C, menu_change_hotkey, but);
}
@ -3832,12 +3833,14 @@ static int ui_mouse_inside_button(ARegion *ar, uiBut *but, int x, int y)
return 1;
}
static uiBut *ui_but_find_mouse_over(ARegion *ar, int x, int y)
static uiBut *ui_but_find_mouse_over(wmWindow *win, ARegion *ar, int x, int y)
{
uiBlock *block;
uiBut *but, *butover= NULL;
int mx, my;
if(!win->active)
return NULL;
if(!ui_mouse_inside_region(ar, x, y))
return NULL;
@ -3859,12 +3862,14 @@ static uiBut *ui_but_find_mouse_over(ARegion *ar, int x, int y)
return butover;
}
static uiBut *ui_list_find_mouse_over(ARegion *ar, int x, int y)
static uiBut *ui_list_find_mouse_over(wmWindow *win, ARegion *ar, int x, int y)
{
uiBlock *block;
uiBut *but;
int mx, my;
if(!win->active)
return NULL;
if(!ui_mouse_inside_region(ar, x, y))
return NULL;
@ -4171,10 +4176,11 @@ static uiBut *uit_but_find_open_event(ARegion *ar, wmEvent *event)
static int ui_handle_button_over(bContext *C, wmEvent *event, ARegion *ar)
{
wmWindow *win= CTX_wm_window(C);
uiBut *but;
if(event->type == MOUSEMOVE) {
but= ui_but_find_mouse_over(ar, event->x, event->y);
but= ui_but_find_mouse_over(win, ar, event->x, event->y);
if(but)
button_activate_init(C, ar, but, BUTTON_ACTIVATE_OVER);
}
@ -4240,14 +4246,18 @@ static int ui_handle_button_event(bContext *C, wmEvent *event, uiBut *but)
if(data->state == BUTTON_STATE_HIGHLIGHT) {
switch(event->type) {
case WINDEACTIVATE:
data->cancel= 1;
button_activate_state(C, but, BUTTON_STATE_EXIT);
retval= WM_UI_HANDLER_CONTINUE;
break;
case MOUSEMOVE:
/* verify if we are still over the button, if not exit */
if(!ui_mouse_inside_button(ar, but, event->x, event->y)) {
data->cancel= 1;
button_activate_state(C, but, BUTTON_STATE_EXIT);
}
else if(ui_but_find_mouse_over(ar, event->x, event->y) != but) {
else if(ui_but_find_mouse_over(data->window, ar, event->x, event->y) != but) {
data->cancel= 1;
button_activate_state(C, but, BUTTON_STATE_EXIT);
}
@ -4295,8 +4305,12 @@ static int ui_handle_button_event(bContext *C, wmEvent *event, uiBut *but)
}
else if(data->state == BUTTON_STATE_WAIT_RELEASE) {
switch(event->type) {
case WINDEACTIVATE:
data->cancel= 1;
button_activate_state(C, but, BUTTON_STATE_EXIT);
break;
case MOUSEMOVE:
if(ELEM(but->type,LINK, INLINK)) {
but->flag |= UI_SELECT;
ui_do_button(C, block, but, event);
@ -4341,7 +4355,7 @@ static int ui_handle_button_event(bContext *C, wmEvent *event, uiBut *but)
else if(data->state == BUTTON_STATE_MENU_OPEN) {
switch(event->type) {
case MOUSEMOVE: {
uiBut *bt= ui_but_find_mouse_over(ar, event->x, event->y);
uiBut *bt= ui_but_find_mouse_over(data->window, ar, event->x, event->y);
if(bt && bt->active != data) {
if(but->type != COL) /* exception */
@ -4376,7 +4390,8 @@ static int ui_handle_button_event(bContext *C, wmEvent *event, uiBut *but)
static int ui_handle_list_event(bContext *C, wmEvent *event, ARegion *ar)
{
uiBut *but= ui_list_find_mouse_over(ar, event->x, event->y);
wmWindow *win= CTX_wm_window(C);
uiBut *but= ui_list_find_mouse_over(win, ar, event->x, event->y);
int retval= WM_UI_HANDLER_CONTINUE;
int value, min, max;

View File

@ -1252,8 +1252,14 @@ void init_userdef_do_versions(void)
/* new audio system */
if(U.audiochannels == 0)
U.audiochannels = 2;
if(U.audiodevice == 0)
if(U.audiodevice == 0) {
#ifdef WITH_OPENAL
U.audiodevice = 2;
#endif
#ifdef WITH_SDL
U.audiodevice = 1;
#endif
}
if(U.audioformat == 0)
U.audioformat = 0x24;
if(U.audiorate == 0)

View File

@ -1089,30 +1089,11 @@ void ED_area_newspace(bContext *C, ScrArea *sa, int type)
}
}
void ED_area_prevspace(bContext *C)
void ED_area_prevspace(bContext *C, ScrArea *sa)
{
SpaceLink *sl= CTX_wm_space_data(C);
ScrArea *sa= CTX_wm_area(C);
/* cleanup */
#if 0 // XXX needs to be space type specific
if(sfile->spacetype==SPACE_FILE) {
if(sfile->pupmenu) {
MEM_freeN(sfile->pupmenu);
sfile->pupmenu= NULL;
}
}
#endif
SpaceLink *sl = (sa) ? sa->spacedata.first : CTX_wm_space_data(C);
if(sl->next) {
#if 0 // XXX check whether this is still needed
if (sfile->spacetype == SPACE_SCRIPT) {
SpaceScript *sc = (SpaceScript *)sfile;
if (sc->script) sc->script->flags &=~SCRIPT_FILESEL;
}
#endif
/* workaround for case of double prevspace, render window
with a file browser on top of it */
if(sl->next->spacetype == SPACE_FILE && sl->next->next)
@ -1193,7 +1174,8 @@ int ED_area_header_standardbuttons(const bContext *C, uiBlock *block, int yco)
ScrArea *sa= CTX_wm_area(C);
int xco= 8;
xco= ED_area_header_switchbutton(C, block, yco);
if (!sa->full)
xco= ED_area_header_switchbutton(C, block, yco);
uiBlockSetEmboss(block, UI_EMBOSSN);

View File

@ -1312,7 +1312,13 @@ void ED_screen_delete(bContext *C, bScreen *sc)
wmWindow *win= CTX_wm_window(C);
bScreen *newsc;
int delete= 1;
/* don't allow deleting temp fullscreens for now */
if (sc->full == SCREENFULL) {
return;
}
/* screen can only be in use by one window at a time, so as
long as we are able to find a screen that is unused, we
can safely assume ours is not in use anywhere an delete it */
@ -1462,7 +1468,7 @@ ScrArea *ed_screen_fullarea(bContext *C, wmWindow *win, ScrArea *sa)
// default. So use the old headertype instead
area_copy_data(old, sa, 1); /* 1 = swap spacelist */
if (sa->flag & AREA_TEMP_INFO) sa->flag &= ~AREA_TEMP_INFO;
old->full= NULL;
/* animtimer back */
@ -1496,7 +1502,7 @@ ScrArea *ed_screen_fullarea(bContext *C, wmWindow *win, ScrArea *sa)
/* returns the top small area */
newa= area_split(win, sc, (ScrArea *)sc->areabase.first, 'h', 0.99f);
ED_area_newspace(C, newa, SPACE_INFO);
/* use random area when we have no active one, e.g. when the
mouse is outside of the window and we open a file browser */
if(!sa)
@ -1505,11 +1511,12 @@ ScrArea *ed_screen_fullarea(bContext *C, wmWindow *win, ScrArea *sa)
/* copy area */
newa= newa->prev;
area_copy_data(newa, sa, 1); /* 1 = swap spacelist */
sa->flag |= AREA_TEMP_INFO;
sa->full= oldscreen;
newa->full= oldscreen;
newa->next->full= oldscreen; // XXX
ED_screen_set(C, sc);
}
@ -1524,29 +1531,71 @@ ScrArea *ed_screen_fullarea(bContext *C, wmWindow *win, ScrArea *sa)
int ED_screen_full_newspace(bContext *C, ScrArea *sa, int type)
{
wmWindow *win= CTX_wm_window(C);
bScreen *screen= CTX_wm_screen(C);
ScrArea *newsa= NULL;
if(!sa || sa->full==0)
if(!sa || sa->full==0) {
newsa= ed_screen_fullarea(C, win, sa);
if(!newsa)
newsa= sa;
}
if(!newsa) {
if (sa->full) {
/* if this has been called from the temporary info header generated in
* temp fullscreen layouts, find the correct fullscreen area to change
* to create a new space inside */
for (newsa = screen->areabase.first; newsa; newsa=newsa->next) {
if (!(sa->flag & AREA_TEMP_INFO))
break;
}
} else
newsa= sa;
}
ED_area_newspace(C, newsa, type);
return 1;
}
void ED_screen_full_prevspace(bContext *C)
void ED_screen_full_prevspace(bContext *C, ScrArea *sa)
{
wmWindow *win= CTX_wm_window(C);
ScrArea *sa= CTX_wm_area(C);
ED_area_prevspace(C);
ED_area_prevspace(C, sa);
if(sa->full)
ed_screen_fullarea(C, win, sa);
}
/* restore a screen / area back to default operation, after temp fullscreen modes */
void ED_screen_full_restore(bContext *C, ScrArea *sa)
{
wmWindow *win= CTX_wm_window(C);
SpaceLink *sl = sa->spacedata.first;
/* if fullscreen area has a secondary space (such as as file browser or fullscreen render
* overlaid on top of a existing setup) then return to the previous space */
if (sl->next) {
/* specific checks for space types */
if (sl->spacetype == SPACE_IMAGE) {
SpaceImage *sima= sa->spacedata.first;
if (sima->flag & SI_PREVSPACE)
sima->flag &= ~SI_PREVSPACE;
if (sima->flag & SI_FULLWINDOW) {
sima->flag &= ~SI_FULLWINDOW;
ED_screen_full_prevspace(C, sa);
}
} else if (sl->spacetype == SPACE_FILE) {
ED_screen_full_prevspace(C, sa);
} else
ed_screen_fullarea(C, win, sa);
}
/* otherwise just tile the area again */
else {
ed_screen_fullarea(C, win, sa);
}
}
/* redraws: uses defines from stime->redraws
* enable: 1 - forward on, -1 - backwards on, 0 - off
*/
@ -1601,10 +1650,8 @@ static ARegion *time_top_left_3dwindow(bScreen *screen)
return aret;
}
void ED_screen_animation_timer_update(bContext *C, int redraws)
void ED_screen_animation_timer_update(bScreen *screen, int redraws)
{
bScreen *screen= CTX_wm_screen(C);
if(screen && screen->animtimer) {
wmTimer *wt= screen->animtimer;
ScreenAnimData *sad= wt->customdata;

View File

@ -1544,10 +1544,10 @@ static int screen_set_exec(bContext *C, wmOperator *op)
int tot= BLI_countlist(&CTX_data_main(C)->screen);
int delta= RNA_int_get(op->ptr, "delta");
/* this screen is 'fake', solve later XXX */
/* return to previous state before switching screens */
if(sa && sa->full)
return OPERATOR_CANCELLED;
ED_screen_full_restore(C, sa);
if(delta==1) {
while(tot--) {
screen= screen->id.next;
@ -2418,7 +2418,7 @@ static int screen_animation_play(bContext *C, wmOperator *op, wmEvent *event)
ED_screen_animation_timer(C, stime->redraws, sync, mode);
/* update region if TIME_REGION was set, to leftmost 3d window */
ED_screen_animation_timer_update(C, stime->redraws);
ED_screen_animation_timer_update(screen, stime->redraws);
}
else {
int redraws = TIME_REGION|TIME_ALL_3D_WIN;
@ -3412,10 +3412,10 @@ static int render_view_cancel_exec(bContext *C, wmOperator *unused)
if(sima->flag & SI_FULLWINDOW) {
sima->flag &= ~SI_FULLWINDOW;
ED_screen_full_prevspace(C);
ED_screen_full_prevspace(C, sa);
}
else
ED_area_prevspace(C);
ED_area_prevspace(C, sa);
return OPERATOR_FINISHED;
}
@ -3459,7 +3459,7 @@ static int render_view_show_invoke(bContext *C, wmOperator *unused, wmEvent *eve
if(sima->flag & SI_FULLWINDOW) {
sima->flag &= ~SI_FULLWINDOW;
ED_screen_full_prevspace(C);
ED_screen_full_prevspace(C, sa);
}
else if(sima->next) {
ED_area_newspace(C, sa, sima->next->spacetype);
@ -3486,6 +3486,40 @@ static void SCREEN_OT_render_view_show(struct wmOperatorType *ot)
ot->poll= ED_operator_screenactive;
}
/* *********************** generic fullscreen 'back' button *************** */
static int fullscreen_back_exec(bContext *C, wmOperator *op)
{
bScreen *screen = CTX_wm_screen(C);
ScrArea *sa=NULL;
/* search current screen for 'fullscreen' areas */
for (sa=screen->areabase.first; sa; sa=sa->next) {
if (sa->full) break;
}
if (!sa) {
BKE_report(op->reports, RPT_ERROR, "No fullscreen areas were found.");
return OPERATOR_CANCELLED;
}
ED_screen_full_restore(C, sa);
return OPERATOR_FINISHED;
}
static void SCREEN_OT_back_to_previous(struct wmOperatorType *ot)
{
/* identifiers */
ot->name= "Back to Previous Screen";
ot->description= "Revert back to the original screen layout, before fullscreen area overlay.";
ot->idname= "SCREEN_OT_back_to_previous";
/* api callbacks */
ot->exec= fullscreen_back_exec;
ot->poll= ED_operator_screenactive;
}
/* *********** show user pref window ****** */
static int userpref_show_invoke(bContext *C, wmOperator *unused, wmEvent *event)
@ -3672,6 +3706,7 @@ void ED_operatortypes_screen(void)
WM_operatortype_append(SCREEN_OT_header_toolbox);
WM_operatortype_append(SCREEN_OT_screen_set);
WM_operatortype_append(SCREEN_OT_screen_full_area);
WM_operatortype_append(SCREEN_OT_back_to_previous);
WM_operatortype_append(SCREEN_OT_screenshot);
WM_operatortype_append(SCREEN_OT_screencast);
WM_operatortype_append(SCREEN_OT_userpref_show);

View File

@ -1,348 +0,0 @@
/**
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
*
*
* Contributor(s): Blender Foundation
*
* ***** END GPL LICENSE BLOCK *****
*/
#include <string.h>
#include <stdio.h>
#include "DNA_anim_types.h"
#include "DNA_action_types.h"
#include "DNA_key_types.h"
#include "DNA_object_types.h"
#include "DNA_space_types.h"
#include "DNA_scene_types.h"
#include "DNA_screen_types.h"
#include "DNA_windowmanager_types.h"
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
#include "BKE_animsys.h"
#include "BKE_action.h"
#include "BKE_context.h"
#include "BKE_screen.h"
#include "ED_anim_api.h"
#include "ED_screen.h"
#include "ED_transform.h"
#include "ED_types.h"
#include "ED_util.h"
#include "RNA_access.h"
#include "WM_api.h"
#include "WM_types.h"
#include "BIF_gl.h"
#include "BIF_glutil.h"
#include "UI_interface.h"
#include "UI_resources.h"
#include "UI_view2d.h"
#include "action_intern.h"
enum {
B_REDR= 1,
B_MODECHANGE,
} eActHeader_Events;
/* ********************************************************* */
/* Menu Defines... */
static void act_viewmenu(bContext *C, uiLayout *layout, void *arg_unused)
{
bScreen *sc= CTX_wm_screen(C);
ScrArea *sa= CTX_wm_area(C);
SpaceAction *sact= CTX_wm_space_action(C);
PointerRNA spaceptr;
/* retrieve state */
RNA_pointer_create(&sc->id, &RNA_SpaceDopeSheetEditor, sact, &spaceptr);
/* create menu */
//uiItemO(layout, NULL, ICON_MENU_PANEL, "ACTION_OT_properties");
//uiItemS(layout);
uiItemR(layout, NULL, 0, &spaceptr, "show_cframe_indicator", 0);
uiItemR(layout, NULL, 0, &spaceptr, "show_sliders", 0);
uiItemR(layout, NULL, 0, &spaceptr, "automerge_keyframes", 0);
if (sact->flag & SACTION_DRAWTIME)
uiItemO(layout, "Show Frames", 0, "ANIM_OT_time_toggle");
else
uiItemO(layout, "Show Seconds", 0, "ANIM_OT_time_toggle");
uiItemS(layout);
uiItemO(layout, NULL, 0, "ANIM_OT_previewrange_set");
uiItemO(layout, NULL, 0, "ANIM_OT_previewrange_clear");
uiItemO(layout, NULL, 0, "ACTION_OT_previewrange_set");
uiItemS(layout);
uiItemO(layout, NULL, 0, "ACTION_OT_frame_jump");
uiItemO(layout, NULL, 0, "ACTION_OT_view_all");
if (sa->full)
uiItemO(layout, NULL, 0, "SCREEN_OT_screen_full_area"); // "Tile Window", Ctrl UpArrow
else
uiItemO(layout, NULL, 0, "SCREEN_OT_screen_full_area"); // "Maximize Window", Ctrl DownArrow
}
static void act_selectmenu(bContext *C, uiLayout *layout, void *arg_unused)
{
uiItemO(layout, NULL, 0, "ACTION_OT_select_all_toggle");
uiItemBooleanO(layout, "Invert All", 0, "ACTION_OT_select_all_toggle", "invert", 1);
uiItemS(layout);
uiItemO(layout, NULL, 0, "ACTION_OT_select_border");
uiItemBooleanO(layout, "Border Axis Range", 0, "ACTION_OT_select_border", "axis_range", 1);
uiItemS(layout);
uiItemEnumO(layout, "Columns on Selected Keys", 0, "ACTION_OT_select_column", "mode", ACTKEYS_COLUMNSEL_KEYS);
uiItemEnumO(layout, "Column on Current Frame", 0, "ACTION_OT_select_column", "mode", ACTKEYS_COLUMNSEL_CFRA);
uiItemEnumO(layout, "Columns on Selected Markers", 0, "ACTION_OT_select_column", "mode", ACTKEYS_COLUMNSEL_MARKERS_COLUMN);
uiItemEnumO(layout, "Between Selected Markers", 0, "ACTION_OT_select_column", "mode", ACTKEYS_COLUMNSEL_MARKERS_BETWEEN);
}
static void act_channelmenu(bContext *C, uiLayout *layout, void *arg_unused)
{
uiItemO(layout, NULL, 0, "ANIM_OT_channels_setting_toggle");
uiItemO(layout, NULL, 0, "ANIM_OT_channels_setting_enable");
uiItemO(layout, NULL, 0, "ANIM_OT_channels_setting_disable");
uiItemS(layout);
uiItemO(layout, NULL, 0, "ANIM_OT_channels_editable_toggle");
uiItemS(layout);
uiItemO(layout, NULL, 0, "ANIM_OT_channels_expand");
uiItemO(layout, NULL, 0, "ANIM_OT_channels_collapse");
}
static void act_gplayermenu(bContext *C, uiLayout *layout, void *arg_unused)
{
//uiItemMenuF(layout, "Transform", 0, nla_edit_transformmenu, NULL, NULL);
//uiItemS(layout);
//uiItemO(layout, NULL, 0, "NLAEDIT_OT_duplicate");
}
static void act_edit_transformmenu(bContext *C, uiLayout *layout, void *arg_unused)
{
uiItemEnumO(layout, "Grab/Move", 0, "TFM_OT_transform", "mode", TFM_TIME_TRANSLATE);
uiItemEnumO(layout, "Extend", 0, "TFM_OT_transform", "mode", TFM_TIME_EXTEND);
uiItemEnumO(layout, "Scale", 0, "TFM_OT_transform", "mode", TFM_TIME_SCALE);
}
static void act_editmenu(bContext *C, uiLayout *layout, void *arg_unused)
{
uiItemMenuF(layout, "Transform", 0, act_edit_transformmenu, NULL);
uiItemMenuEnumO(layout, "Snap", 0, "ACTION_OT_snap", "type");
uiItemMenuEnumO(layout, "Mirror", 0, "ACTION_OT_mirror", "type");
uiItemS(layout);
uiItemO(layout, NULL, 0, "ACT_OT_keyframe_insert");
uiItemS(layout);
uiItemO(layout, NULL, 0, "ACTION_OT_duplicate");
uiItemO(layout, NULL, 0, "ACTION_OT_delete");
uiItemS(layout);
uiItemMenuEnumO(layout, "Keyframe Type", 0, "ACTION_OT_keyframe_type", "type");
uiItemMenuEnumO(layout, "Handle Type", 0, "ACTION_OT_handle_type", "type");
uiItemMenuEnumO(layout, "Interpolation Type", 0, "ACTION_OT_interpolation_type", "type");
uiItemMenuEnumO(layout, "Extrapolation Type", 0, "ACTION_OT_extrapolation_type", "type");
uiItemS(layout);
uiItemO(layout, NULL, 0, "ACTION_OT_clean");
uiItemO(layout, NULL, 0, "ACTION_OT_sample");
uiItemS(layout);
uiItemO(layout, NULL, 0, "ACTION_OT_copy");
uiItemO(layout, NULL, 0, "ACTION_OT_paste");
}
/* ************************ header area region *********************** */
static void do_action_buttons(bContext *C, void *arg, int event)
{
/* special exception for mode changing - enable custom settings? */
if (event == B_MODECHANGE) {
SpaceAction *saction= CTX_wm_space_action(C);
/* if the new mode is ShapeKeys editor, enable sliders */
if (saction->mode == SACTCONT_SHAPEKEY)
saction->flag |= SACTION_SLIDERS;
}
ED_area_tag_refresh(CTX_wm_area(C));
ED_area_tag_redraw(CTX_wm_area(C));
}
void action_header_buttons(const bContext *C, ARegion *ar)
{
ScrArea *sa= CTX_wm_area(C);
SpaceAction *saction= CTX_wm_space_action(C);
bAnimContext ac;
uiBlock *block;
int xco, yco= 3, xmax;
block= uiBeginBlock(C, ar, "header buttons", UI_EMBOSS);
uiBlockSetHandleFunc(block, do_action_buttons, NULL);
xco= ED_area_header_standardbuttons(C, block, yco);
uiBlockSetEmboss(block, UI_EMBOSS);
/* get context... (also syncs data) */
ANIM_animdata_get_context(C, &ac);
if ((sa->flag & HEADER_NO_PULLDOWN)==0) {
xmax= GetButStringLength("View");
uiDefMenuBut(block, act_viewmenu, NULL, "View", xco, yco, xmax-3, 20, "");
xco+= xmax;
xmax= GetButStringLength("Select");
uiDefMenuBut(block, act_selectmenu, NULL, "Select", xco, yco, xmax-3, 20, "");
xco+= xmax;
if ( (saction->mode == SACTCONT_DOPESHEET) ||
((saction->action) && (saction->mode==SACTCONT_ACTION)) )
{
xmax= GetButStringLength("Channel");
uiDefMenuBut(block, act_channelmenu, NULL, "Channel", xco, yco, xmax-3, 20, "");
xco+= xmax;
}
else if (saction->mode==SACTCONT_GPENCIL) {
xmax= GetButStringLength("Channel");
uiDefMenuBut(block, act_gplayermenu, NULL, "Channel", xco, yco, xmax-3, 20, "");
xco+= xmax;
}
//xmax= GetButStringLength("Marker");
//uiDefMenuBut(block, act_markermenu, NULL, "Marker", xco, yco, xmax-3, 20, "");
//xco+= xmax;
if (saction->mode == SACTCONT_GPENCIL) {
//xmax= GetButStringLength("Frame");
//uiDefMenuBut(block, act_selectmenu, NULL, "Frame", xco, yco, xmax-3, 20, "");
//xco+= xmax;
}
else {
xmax= GetButStringLength("Key");
uiDefMenuBut(block, act_editmenu, NULL, "Key", xco, yco, xmax-3, 20, "");
xco+= xmax;
}
}
uiBlockSetEmboss(block, UI_EMBOSS);
/* MODE SELECTOR */
uiDefButC(block, MENU, B_MODECHANGE,
"Editor Mode %t|DopeSheet %x3|Action Editor %x0|ShapeKey Editor %x1|Grease Pencil %x2",
xco,yco,90,YIC, &saction->mode, 0, 1, 0, 0,
"Editing modes for this editor");
xco += (90 + 8);
/* SUMMARY CHANNEL */
uiDefIconTextButBitI(block, TOG, ADS_FILTER_SUMMARY, B_REDR, ICON_BORDERMOVE, "Summary", xco,yco,XIC*4,YIC, &(saction->ads.filterflag), 0, 0, 0, 0, "Include DopeSheet summary row"); // TODO: needs a better icon
xco += (XIC*4.5);
/*if (ac.data)*/
{
/* MODE-DEPENDENT DRAWING */
if (saction->mode == SACTCONT_DOPESHEET) {
/* FILTERING OPTIONS */
xco -= XIC; // XXX first button incurs this offset...
xco= ANIM_headerUI_standard_buttons(C, &saction->ads, block, xco, yco);
}
else if (saction->mode == SACTCONT_ACTION) {
uiLayout *layout;
bScreen *sc= CTX_wm_screen(C);
PointerRNA ptr;
RNA_pointer_create(&sc->id, &RNA_SpaceDopeSheetEditor, saction, &ptr);
layout= uiBlockLayout(block, UI_LAYOUT_HORIZONTAL, UI_LAYOUT_HEADER, xco, 20+3, 20, 1, U.uistyles.first);
uiTemplateID(layout, (bContext*)C, &ptr, "action", "ACTION_OT_new", NULL, NULL);
uiBlockLayoutResolve(block, &xco, NULL);
xco += 8;
}
/* draw AUTOSNAP */
if (saction->mode != SACTCONT_GPENCIL) {
if (saction->flag & SACTION_DRAWTIME) {
uiDefButC(block, MENU, B_REDR,
"Auto-Snap Keyframes %t|No Snap %x0|Second Step %x1|Nearest Second %x2|Nearest Marker %x3",
xco,yco,90,YIC, &(saction->autosnap), 0, 1, 0, 0,
"Auto-snapping mode for keyframes when transforming");
}
else {
uiDefButC(block, MENU, B_REDR,
"Auto-Snap Keyframes %t|No Snap %x0|Frame Step %x1|Nearest Frame %x2|Nearest Marker %x3",
xco,yco,90,YIC, &(saction->autosnap), 0, 1, 0, 0,
"Auto-snapping mode for keyframes when transforming");
}
xco += (90 + 8);
}
/* COPY PASTE */
uiBlockBeginAlign(block);
uiDefIconButO(block, BUT, "ACTION_OT_copy", WM_OP_INVOKE_REGION_WIN, ICON_COPYDOWN, xco,yco,XIC,YIC, "Copies the selected keyframes to the buffer.");
xco += XIC;
uiDefIconButO(block, BUT, "ACTION_OT_paste", WM_OP_INVOKE_REGION_WIN, ICON_PASTEDOWN, xco,yco,XIC,YIC, "Pastes the keyframes from the buffer into the selected channels.");
uiBlockEndAlign(block);
xco += (XIC + 8);
}
/* always as last */
UI_view2d_totRect_set(&ar->v2d, xco+XIC+80, (int)(ar->v2d.tot.ymax-ar->v2d.tot.ymin));
uiEndBlock(C, block);
uiDrawBlock(C, block);
}

View File

@ -259,29 +259,12 @@ static void action_channel_area_draw(const bContext *C, ARegion *ar)
/* add handlers, stuff you only do once or on area/region changes */
static void action_header_area_init(wmWindowManager *wm, ARegion *ar)
{
UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_HEADER, ar->winx, ar->winy);
ED_region_header_init(ar);
}
static void action_header_area_draw(const bContext *C, ARegion *ar)
{
float col[3];
/* clear */
if(ED_screen_area_active(C))
UI_GetThemeColor3fv(TH_HEADER, col);
else
UI_GetThemeColor3fv(TH_HEADERDESEL, col);
glClearColor(col[0], col[1], col[2], 0.0);
glClear(GL_COLOR_BUFFER_BIT);
/* set view2d view matrix for scrolling (without scrollers) */
UI_view2d_view_ortho(C, &ar->v2d);
action_header_buttons(C, ar);
/* restore view matrix? */
UI_view2d_view_restore(C);
ED_region_header(C, ar);
}
static void action_channel_area_listener(ARegion *ar, wmNotifier *wmn)

View File

@ -369,9 +369,6 @@ void CONSOLE_OT_move(wmOperatorType *ot)
ot->exec= move_exec;
ot->poll= console_edit_poll;
/* flags */
ot->flag= OPTYPE_REGISTER;
/* properties */
RNA_def_enum(ot->srna, "type", move_type_items, LINE_BEGIN, "Type", "Where to move cursor to.");
}
@ -415,9 +412,6 @@ void CONSOLE_OT_insert(wmOperatorType *ot)
ot->invoke= insert_invoke;
ot->poll= console_edit_poll;
/* flags */
ot->flag= OPTYPE_REGISTER;
/* properties */
RNA_def_string(ot->srna, "text", "", 0, "Text", "Text to insert at the cursor position.");
}
@ -482,9 +476,6 @@ void CONSOLE_OT_delete(wmOperatorType *ot)
ot->exec= delete_exec;
ot->poll= console_edit_poll;
/* flags */
ot->flag= OPTYPE_REGISTER;
/* properties */
RNA_def_enum(ot->srna, "type", delete_type_items, DEL_NEXT_CHAR, "Type", "Which part of the text to delete.");
}
@ -525,9 +516,6 @@ void CONSOLE_OT_clear(wmOperatorType *ot)
/* api callbacks */
ot->exec= clear_exec;
ot->poll= console_edit_poll;
/* flags */
ot->flag= OPTYPE_REGISTER;
/* properties */
RNA_def_boolean(ot->srna, "scrollback", 1, "Scrollback", "Clear the scrollback history");
@ -587,9 +575,6 @@ void CONSOLE_OT_history_cycle(wmOperatorType *ot)
/* api callbacks */
ot->exec= history_cycle_exec;
ot->poll= console_edit_poll;
/* flags */
ot->flag= OPTYPE_REGISTER;
/* properties */
RNA_def_boolean(ot->srna, "reverse", 0, "Reverse", "reverse cycle history");
@ -635,9 +620,6 @@ void CONSOLE_OT_history_append(wmOperatorType *ot)
/* api callbacks */
ot->exec= history_append_exec;
ot->poll= console_edit_poll;
/* flags */
ot->flag= OPTYPE_REGISTER;
/* properties */
RNA_def_string(ot->srna, "text", "", 0, "Text", "Text to insert at the cursor position.");
@ -683,9 +665,6 @@ void CONSOLE_OT_scrollback_append(wmOperatorType *ot)
/* api callbacks */
ot->exec= scrollback_append_exec;
ot->poll= console_edit_poll;
/* flags */
ot->flag= OPTYPE_REGISTER;
/* properties */
RNA_def_string(ot->srna, "text", "", 0, "Text", "Text to insert at the cursor position.");
@ -727,9 +706,6 @@ void CONSOLE_OT_copy(wmOperatorType *ot)
ot->poll= console_edit_poll;
ot->exec= copy_exec;
/* flags */
ot->flag= OPTYPE_REGISTER;
/* properties */
}
@ -762,9 +738,6 @@ void CONSOLE_OT_paste(wmOperatorType *ot)
ot->poll= console_edit_poll;
ot->exec= paste_exec;
/* flags */
ot->flag= OPTYPE_REGISTER;
/* properties */
}
@ -795,9 +768,6 @@ void CONSOLE_OT_zoom(wmOperatorType *ot)
/* api callbacks */
ot->exec= zoom_exec;
ot->poll= console_poll;
/* flags */
/* ot->flag= OPTYPE_REGISTER; */ /* super annoying */
/* properties */
RNA_def_int(ot->srna, "delta", 0, 0, INT_MAX, "Delta", "Scale the view font.", 0, 1000);

View File

@ -29,6 +29,7 @@
#include "BKE_context.h"
#include "BKE_screen.h"
#include "BKE_global.h"
#include "BKE_report.h"
#include "BLI_blenlib.h"
#include "BLI_storage_types.h"
@ -745,32 +746,55 @@ int file_next_exec(bContext *C, wmOperator *unused)
return OPERATOR_FINISHED;
}
int file_directory_new_exec(bContext *C, wmOperator *unused)
/* create a new, non-existing folder name, returns 1 if successful, 0 if name couldn't be created.
The actual name is returned in 'name', 'folder' contains the complete path, including the new folder name.
*/
static int new_folder_path(const char* parent, char *folder, char *name)
{
char tmpstr[FILE_MAX];
char tmpdir[FILE_MAXFILE];
int i = 1;
int len = 0;
BLI_strncpy(name, "New Folder", FILE_MAXFILE);
BLI_join_dirfile(folder, parent, name);
/* check whether folder with the name already exists, in this case
add number to the name. Check length of generated name to avoid
crazy case of huge number of folders each named 'New Folder (x)' */
while (BLI_exists(folder) && (len<FILE_MAXFILE)) {
len = BLI_snprintf(name, FILE_MAXFILE, "New Folder(%d)", i);
BLI_join_dirfile(folder, parent, name);
i++;
}
return (len<FILE_MAXFILE);
}
int file_directory_new_exec(bContext *C, wmOperator *op)
{
char name[FILE_MAXFILE];
char path[FILE_MAX];
SpaceFile *sfile= CTX_wm_space_file(C);
if(sfile->params) {
BLI_strncpy(tmpstr, sfile->params->dir, FILE_MAX);
BLI_join_dirfile(tmpstr, tmpstr, "New Folder");
while (BLI_exists(tmpstr)) {
BLI_snprintf(tmpdir, FILE_MAXFILE, "New Folder(%d)", i++);
BLI_strncpy(tmpstr, sfile->params->dir, FILE_MAX);
BLI_join_dirfile(tmpstr, tmpstr, tmpdir);
}
BLI_recurdir_fileops(tmpstr);
if (BLI_exists(tmpstr)) {
BLI_strncpy(sfile->params->renamefile, tmpdir, FILE_MAXFILE);
} else {
filelist_free(sfile->files);
filelist_parent(sfile->files);
BLI_strncpy(sfile->params->dir, filelist_dir(sfile->files), FILE_MAX);
}
}
if(!sfile->params) {
BKE_report(op->reports,RPT_WARNING, "No parent directory given.");
return OPERATOR_CANCELLED;
}
/* create a new, non-existing folder name */
if (!new_folder_path(sfile->params->dir, path, name)) {
BKE_report(op->reports,RPT_ERROR, "Couldn't create new folder name.");
return OPERATOR_CANCELLED;
}
/* rename the file */
BLI_recurdir_fileops(path);
if (!BLI_exists(path)) {
BKE_report(op->reports,RPT_ERROR, "Couldn't create new folder.");
return OPERATOR_CANCELLED;
}
/* now remember file to jump into editing */
BLI_strncpy(sfile->params->renamefile, name, FILE_MAXFILE);
WM_event_add_notifier(C, NC_SPACE|ND_SPACE_FILE_LIST, NULL);
return OPERATOR_FINISHED;

View File

@ -1,73 +0,0 @@
/**
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
*
*
* Contributor(s): Blender Foundation
*
* ***** END GPL LICENSE BLOCK *****
*/
#include <string.h>
#include <stdio.h>
#include "DNA_anim_types.h"
#include "DNA_space_types.h"
#include "DNA_scene_types.h"
#include "DNA_screen_types.h"
#include "DNA_windowmanager_types.h"
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
#include "BKE_context.h"
#include "BKE_screen.h"
#include "ED_anim_api.h"
#include "ED_transform.h"
#include "ED_screen.h"
#include "ED_types.h"
#include "ED_util.h"
#include "RNA_access.h"
#include "WM_api.h"
#include "WM_types.h"
#include "BIF_gl.h"
#include "BIF_glutil.h"
#include "UI_interface.h"
#include "UI_resources.h"
#include "UI_view2d.h"
#include "graph_intern.h"
/* ********************************************************* */
static void do_graph_buttons(bContext *C, void *arg, int event)
{
ED_area_tag_refresh(CTX_wm_area(C));
ED_area_tag_redraw(CTX_wm_area(C));
}

View File

@ -391,7 +391,7 @@ static void image_main_area_init(wmWindowManager *wm, ARegion *ar)
// UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_STANDARD, ar->winx, ar->winy);
/* image paint polls for mode */
keymap= WM_keymap_find(wm->defaultconf, "Image Paint", SPACE_IMAGE, 0);
keymap= WM_keymap_find(wm->defaultconf, "Image Paint", 0, 0);
WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
keymap= WM_keymap_find(wm->defaultconf, "UVEdit", 0, 0);

View File

@ -1,262 +0,0 @@
/**
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
*
*
* Contributor(s): Blender Foundation, Joshua Leung
*
* ***** END GPL LICENSE BLOCK *****
*/
#include <string.h>
#include <stdio.h>
#include "DNA_anim_types.h"
#include "DNA_action_types.h"
#include "DNA_nla_types.h"
#include "DNA_object_types.h"
#include "DNA_space_types.h"
#include "DNA_scene_types.h"
#include "DNA_screen_types.h"
#include "DNA_windowmanager_types.h"
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
#include "BLI_math.h"
#include "BLI_rand.h"
#include "BKE_animsys.h"
#include "BKE_nla.h"
#include "BKE_context.h"
#include "BKE_report.h"
#include "BKE_screen.h"
#include "ED_types.h"
#include "ED_util.h"
#include "ED_anim_api.h"
#include "ED_markers.h"
#include "ED_space_api.h"
#include "ED_screen.h"
#include "ED_transform.h"
#include "BIF_gl.h"
#include "RNA_access.h"
#include "WM_api.h"
#include "WM_types.h"
#include "UI_interface.h"
#include "UI_resources.h"
#include "UI_view2d.h"
#include "nla_intern.h"
/* button events */
enum {
B_REDR = 1,
} eNLAHeader_ButEvents;
/* ************************ header area region *********************** */
static void nla_viewmenu(bContext *C, uiLayout *layout, void *arg_unused)
{
bScreen *sc= CTX_wm_screen(C);
ScrArea *sa= CTX_wm_area(C);
SpaceNla *snla= CTX_wm_space_nla(C);
PointerRNA spaceptr;
/* retrieve state */
RNA_pointer_create(&sc->id, &RNA_SpaceNLA, snla, &spaceptr);
/* create menu */
uiItemO(layout, NULL, ICON_MENU_PANEL, "NLA_OT_properties");
uiItemS(layout);
uiItemR(layout, NULL, 0, &spaceptr, "show_cframe_indicator", 0);
if (snla->flag & SNLA_DRAWTIME)
uiItemO(layout, "Show Frames", 0, "ANIM_OT_time_toggle");
else
uiItemO(layout, "Show Seconds", 0, "ANIM_OT_time_toggle");
uiItemR(layout, NULL, 0, &spaceptr, "show_strip_curves", 0);
uiItemS(layout);
uiItemS(layout);
uiItemO(layout, NULL, 0, "ANIM_OT_previewrange_set");
uiItemO(layout, NULL, 0, "ANIM_OT_previewrange_clear");
uiItemS(layout);
//uiItemO(layout, NULL, 0, "NLA_OT_view_all");
if (sa->full)
uiItemO(layout, NULL, 0, "SCREEN_OT_screen_full_area"); // "Tile Window", Ctrl UpArrow
else
uiItemO(layout, NULL, 0, "SCREEN_OT_screen_full_area"); // "Maximize Window", Ctr DownArrow
}
static void nla_selectmenu(bContext *C, uiLayout *layout, void *arg_unused)
{
uiItemO(layout, NULL, 0, "NLA_OT_select_all_toggle");
uiItemBooleanO(layout, "Invert All", 0, "NLA_OT_select_all_toggle", "invert", 1);
uiItemS(layout);
uiItemO(layout, NULL, 0, "NLA_OT_select_border");
uiItemBooleanO(layout, "Border Axis Range", 0, "NLA_OT_select_border", "axis_range", 1);
}
static void nla_edit_transformmenu(bContext *C, uiLayout *layout, void *arg_unused)
{
// XXX these operators may change for NLA...
uiItemEnumO(layout, "Grab/Move", 0, "TFM_OT_transform", "mode", TFM_TRANSLATION);
uiItemEnumO(layout, "Extend", 0, "TFM_OT_transform", "mode", TFM_TIME_EXTEND);
uiItemEnumO(layout, "Scale", 0, "TFM_OT_transform", "mode", TFM_TIME_SCALE);
}
static void nla_editmenu(bContext *C, uiLayout *layout, void *arg_unused)
{
Scene *scene= CTX_data_scene(C);
uiItemMenuF(layout, "Transform", 0, nla_edit_transformmenu, NULL);
uiItemMenuEnumO(layout, "Snap", 0, "NLA_OT_snap", "type");
uiItemS(layout);
uiItemO(layout, NULL, 0, "NLA_OT_duplicate");
uiItemO(layout, NULL, 0, "NLA_OT_split");
uiItemO(layout, NULL, 0, "NLA_OT_delete");
uiItemS(layout);
uiItemO(layout, NULL, 0, "NLA_OT_mute_toggle");
uiItemS(layout);
uiItemO(layout, NULL, 0, "NLA_OT_apply_scale");
uiItemO(layout, NULL, 0, "NLA_OT_clear_scale");
uiItemS(layout);
uiItemO(layout, NULL, 0, "NLA_OT_move_up");
uiItemO(layout, NULL, 0, "NLA_OT_move_down");
uiItemS(layout);
// TODO: names of these tools for 'tweakmode' need changing?
if (scene->flag & SCE_NLA_EDIT_ON)
uiItemO(layout, "Stop Tweaking Strip Actions", 0, "NLA_OT_tweakmode_exit");
else
uiItemO(layout, "Start Tweaking Strip Actions", 0, "NLA_OT_tweakmode_enter");
}
static void nla_addmenu(bContext *C, uiLayout *layout, void *arg_unused)
{
uiItemO(layout, NULL, 0, "NLA_OT_actionclip_add");
uiItemO(layout, NULL, 0, "NLA_OT_transition_add");
uiItemS(layout);
uiItemO(layout, NULL, 0, "NLA_OT_meta_add");
uiItemO(layout, NULL, 0, "NLA_OT_meta_remove");
uiItemS(layout);
uiItemO(layout, NULL, 0, "NLA_OT_tracks_add");
uiItemBooleanO(layout, "Add Tracks Above Selected", 0, "NLA_OT_tracks_add", "above_selected", 1);
}
/* ------------------ */
static void do_nla_buttons(bContext *C, void *arg, int event)
{
ED_area_tag_refresh(CTX_wm_area(C));
ED_area_tag_redraw(CTX_wm_area(C));
}
void nla_header_buttons(const bContext *C, ARegion *ar)
{
SpaceNla *snla= CTX_wm_space_nla(C);
ScrArea *sa= CTX_wm_area(C);
uiBlock *block;
int xco, yco= 3;
block= uiBeginBlock(C, ar, "header buttons", UI_EMBOSS);
uiBlockSetHandleFunc(block, do_nla_buttons, NULL);
xco= ED_area_header_standardbuttons(C, block, yco);
if ((sa->flag & HEADER_NO_PULLDOWN)==0) {
int xmax;
xmax= GetButStringLength("View");
uiDefMenuBut(block, nla_viewmenu, NULL, "View", xco, yco, xmax-3, 20, "");
xco+= xmax;
xmax= GetButStringLength("Select");
uiDefMenuBut(block, nla_selectmenu, NULL, "Select", xco, yco, xmax-3, 20, "");
xco+= xmax;
xmax= GetButStringLength("Edit");
uiDefMenuBut(block, nla_editmenu, NULL, "Edit", xco, yco, xmax-3, 20, "");
xco+= xmax;
xmax= GetButStringLength("Add");
uiDefMenuBut(block, nla_addmenu, NULL, "Add", xco, yco, xmax-3, 20, "");
xco+= xmax;
}
uiBlockSetEmboss(block, UI_EMBOSS);
/* filtering buttons */
xco= ANIM_headerUI_standard_buttons(C, snla->ads, block, xco, yco);
/* auto-snap selector */
if (snla->flag & SNLA_DRAWTIME) {
uiDefButS(block, MENU, B_REDR,
"Auto-Snap %t|No Time-Snap %x0|Nearest Second %x2|Nearest Marker %x3",
xco,yco,90,YIC, &snla->autosnap, 0, 1, 0, 0,
"Auto-snapping mode for times when transforming");
}
else {
uiDefButS(block, MENU, B_REDR,
"Auto-Snap %t|No Time-Snap %x0|Nearest Frame %x2|Nearest Marker %x3",
xco,yco,90,YIC, &snla->autosnap, 0, 1, 0, 0,
"Auto-snapping mode for times when transforming");
}
xco += 98;
/* always as last */
UI_view2d_totRect_set(&ar->v2d, xco+XIC+80, ar->v2d.tot.ymax-ar->v2d.tot.ymin);
uiEndBlock(C, block);
uiDrawBlock(C, block);
}

View File

@ -331,29 +331,12 @@ static void nla_main_area_draw(const bContext *C, ARegion *ar)
/* add handlers, stuff you only do once or on area/region changes */
static void nla_header_area_init(wmWindowManager *wm, ARegion *ar)
{
UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_HEADER, ar->winx, ar->winy);
ED_region_header_init(ar);
}
static void nla_header_area_draw(const bContext *C, ARegion *ar)
{
float col[3];
/* clear */
if(ED_screen_area_active(C))
UI_GetThemeColor3fv(TH_HEADER, col);
else
UI_GetThemeColor3fv(TH_HEADERDESEL, col);
glClearColor(col[0], col[1], col[2], 0.0);
glClear(GL_COLOR_BUFFER_BIT);
/* set view2d view matrix for scrolling (without scrollers) */
UI_view2d_view_ortho(C, &ar->v2d);
nla_header_buttons(C, ar);
/* restore view matrix? */
UI_view2d_view_restore(C);
ED_region_header(C, ar);
}
/* add handlers, stuff you only do once or on area/region changes */

View File

@ -1471,7 +1471,7 @@ bNode *node_add_node(SpaceNode *snode, Scene *scene, int type, float locx, float
node_set_active(snode, node);
if(snode->nodetree->type==NTREE_COMPOSIT) {
if(ELEM(node->type, CMP_NODE_R_LAYERS, CMP_NODE_COMPOSITE))
if(ELEM3(node->type, CMP_NODE_R_LAYERS, CMP_NODE_COMPOSITE, CMP_NODE_DEFOCUS))
node->id = &scene->id;
ntreeCompositForceHidden(snode->edittree, scene);

View File

@ -218,7 +218,7 @@ static int sequencer_add_scene_strip_exec(bContext *C, wmOperator *op)
seq->flag |= SELECT;
}
ED_area_tag_redraw(CTX_wm_area(C));
WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene);
return OPERATOR_FINISHED;
}
@ -297,8 +297,9 @@ static int sequencer_add_generic_strip_exec(bContext *C, wmOperator *op, SeqLoad
}
sort_seq(scene);
seq_update_muting(ed);
ED_area_tag_redraw(CTX_wm_area(C));
WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene);
return OPERATOR_FINISHED;
}
@ -425,7 +426,7 @@ static int sequencer_add_image_strip_exec(bContext *C, wmOperator *op)
/* last active name */
strncpy(ed->act_imagedir, strip->dir, FILE_MAXDIR-1);
ED_area_tag_redraw(CTX_wm_area(C));
WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene);
return OPERATOR_FINISHED;
}
@ -557,7 +558,8 @@ static int sequencer_add_effect_strip_exec(bContext *C, wmOperator *op)
seq->flag |= SELECT;
}
ED_area_tag_redraw(CTX_wm_area(C));
WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene);
return OPERATOR_FINISHED;
}

View File

@ -1399,7 +1399,7 @@ static int sequencer_snap_exec(bContext *C, wmOperator *op)
/* as last: */
sort_seq(scene);
ED_area_tag_redraw(CTX_wm_area(C));
WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene);
return OPERATOR_FINISHED;
}
@ -1451,21 +1451,18 @@ static int sequencer_mute_exec(bContext *C, wmOperator *op)
for(seq= ed->seqbasep->first; seq; seq= seq->next) {
if ((seq->flag & SEQ_LOCK)==0) {
if(selected){ /* mute unselected */
if (seq->flag & SELECT) {
if(seq->flag & SELECT)
seq->flag |= SEQ_MUTE;
seq_update_sound(seq);
}
}
else {
if ((seq->flag & SELECT)==0) {
if((seq->flag & SELECT)==0)
seq->flag |= SEQ_MUTE;
seq_update_sound(seq);
}
}
}
}
ED_area_tag_redraw(CTX_wm_area(C));
seq_update_muting(ed);
WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene);
return OPERATOR_FINISHED;
}
@ -1505,21 +1502,18 @@ static int sequencer_unmute_exec(bContext *C, wmOperator *op)
for(seq= ed->seqbasep->first; seq; seq= seq->next) {
if ((seq->flag & SEQ_LOCK)==0) {
if(selected){ /* unmute unselected */
if (seq->flag & SELECT) {
if(seq->flag & SELECT)
seq->flag &= ~SEQ_MUTE;
seq_update_sound(seq);
}
}
else {
if ((seq->flag & SELECT)==0) {
if((seq->flag & SELECT)==0)
seq->flag &= ~SEQ_MUTE;
seq_update_sound(seq);
}
}
}
}
ED_area_tag_redraw(CTX_wm_area(C));
seq_update_muting(ed);
WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene);
return OPERATOR_FINISHED;
}
@ -1559,7 +1553,7 @@ static int sequencer_lock_exec(bContext *C, wmOperator *op)
}
}
ED_area_tag_redraw(CTX_wm_area(C));
WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene);
return OPERATOR_FINISHED;
}
@ -1596,7 +1590,7 @@ static int sequencer_unlock_exec(bContext *C, wmOperator *op)
}
}
ED_area_tag_redraw(CTX_wm_area(C));
WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene);
return OPERATOR_FINISHED;
}
@ -1633,7 +1627,7 @@ static int sequencer_reload_exec(bContext *C, wmOperator *op)
}
}
ED_area_tag_redraw(CTX_wm_area(C));
WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene);
return OPERATOR_FINISHED;
}
@ -1665,7 +1659,7 @@ static int sequencer_refresh_all_exec(bContext *C, wmOperator *op)
free_imbuf_seq(scene, &ed->seqbase, FALSE);
ED_area_tag_redraw(CTX_wm_area(C));
WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene);
return OPERATOR_FINISHED;
}
@ -1741,9 +1735,7 @@ static int sequencer_cut_exec(bContext *C, wmOperator *op)
sort_seq(scene);
}
if (changed) {
ED_area_tag_redraw(CTX_wm_area(C));
}
WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene);
return OPERATOR_FINISHED;
}
@ -1803,7 +1795,7 @@ static int sequencer_add_duplicate_exec(bContext *C, wmOperator *op)
recurs_dupli_seq(scene, ed->seqbasep, &new);
addlisttolist(ed->seqbasep, &new);
ED_area_tag_redraw(CTX_wm_area(C));
WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene);
return OPERATOR_FINISHED;
}
@ -1894,8 +1886,7 @@ static int sequencer_delete_exec(bContext *C, wmOperator *op)
ms= ms->prev;
}
//ED_area_tag_redraw(CTX_wm_area(C));
WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, NULL); /* redraw other sequencer views */
WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene);
return OPERATOR_FINISHED;
}
@ -1986,7 +1977,7 @@ static int sequencer_separate_images_exec(bContext *C, wmOperator *op)
/* as last: */
sort_seq(scene);
ED_area_tag_redraw(CTX_wm_area(C));
WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene);
return OPERATOR_FINISHED;
}
@ -2063,7 +2054,9 @@ static int sequencer_meta_toggle_exec(bContext *C, wmOperator *op)
}
ED_area_tag_redraw(CTX_wm_area(C));
seq_update_muting(ed);
WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene);
return OPERATOR_FINISHED;
}
@ -2164,7 +2157,9 @@ static int sequencer_meta_make_exec(bContext *C, wmOperator *op)
if( seq_test_overlap(ed->seqbasep, seqm) ) shuffle_seq(ed->seqbasep, seqm);
ED_area_tag_redraw(CTX_wm_area(C));
seq_update_muting(ed);
WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene);
return OPERATOR_FINISHED;
}
@ -2233,8 +2228,10 @@ static int sequencer_meta_separate_exec(bContext *C, wmOperator *op)
SEQ_END;
sort_seq(scene);
seq_update_muting(ed);
WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene);
ED_area_tag_redraw(CTX_wm_area(C));
return OPERATOR_FINISHED;
}
@ -2459,16 +2456,16 @@ static int next_prev_edit_internal(Scene *scene, int side)
return change;
}
/* select less operator */
/* move frame to next edit point operator */
static int sequencer_next_edit_exec(bContext *C, wmOperator *op)
{
Scene *scene= CTX_data_scene(C);
if (next_prev_edit_internal(scene, SEQ_SIDE_RIGHT)) {
ED_area_tag_redraw(CTX_wm_area(C));
WM_event_add_notifier(C, NC_SCENE|ND_FRAME, scene);
}
if(!next_prev_edit_internal(scene, SEQ_SIDE_RIGHT))
return OPERATOR_CANCELLED;
WM_event_add_notifier(C, NC_SCENE|ND_FRAME, scene);
return OPERATOR_FINISHED;
}
@ -2494,9 +2491,10 @@ static int sequencer_previous_edit_exec(bContext *C, wmOperator *op)
{
Scene *scene= CTX_data_scene(C);
if (next_prev_edit_internal(scene, SEQ_SIDE_LEFT)) {
ED_area_tag_redraw(CTX_wm_area(C));
}
if(!next_prev_edit_internal(scene, SEQ_SIDE_LEFT))
return OPERATOR_CANCELLED;
WM_event_add_notifier(C, NC_SCENE|ND_FRAME, scene);
return OPERATOR_FINISHED;
}
@ -2578,10 +2576,13 @@ static int sequencer_swap_internal_exec(bContext *C, int side)
swap_sequence(active_seq, seq);
break;
}
ED_area_tag_redraw(CTX_wm_area(C));
WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene);
return OPERATOR_FINISHED;
}
return OPERATOR_FINISHED;
return OPERATOR_CANCELLED;
}
static int sequencer_swap_right_exec(bContext *C, wmOperator *op)

View File

@ -256,7 +256,8 @@ static int sequencer_deselect_exec(bContext *C, wmOperator *op)
seq->flag |= SELECT;
}
}
ED_area_tag_redraw(CTX_wm_area(C));
WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER_SELECT, scene);
return OPERATOR_FINISHED;
}
@ -297,7 +298,8 @@ static int sequencer_select_inverse_exec(bContext *C, wmOperator *op)
seq->flag |= SELECT;
}
}
ED_area_tag_redraw(CTX_wm_area(C));
WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER_SELECT, scene);
return OPERATOR_FINISHED;
}
@ -508,7 +510,8 @@ static int sequencer_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
}
#endif
ED_area_tag_redraw(CTX_wm_area(C));
WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER_SELECT, scene);
/* allowing tweaks */
return OPERATOR_FINISHED|OPERATOR_PASS_THROUGH;
}
@ -594,9 +597,10 @@ static int sequencer_select_more_exec(bContext *C, wmOperator *op)
{
Scene *scene= CTX_data_scene(C);
if (select_more_less_seq__internal(scene, 0, 0)) {
ED_area_tag_redraw(CTX_wm_area(C));
}
if(!select_more_less_seq__internal(scene, 0, 0))
return OPERATOR_CANCELLED;
WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER_SELECT, scene);
return OPERATOR_FINISHED;
}
@ -624,9 +628,10 @@ static int sequencer_select_less_exec(bContext *C, wmOperator *op)
{
Scene *scene= CTX_data_scene(C);
if (select_more_less_seq__internal(scene, 1, 0)) {
ED_area_tag_redraw(CTX_wm_area(C));
}
if(!select_more_less_seq__internal(scene, 1, 0))
return OPERATOR_CANCELLED;
WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER_SELECT, scene);
return OPERATOR_FINISHED;
}
@ -681,7 +686,7 @@ static int sequencer_select_linked_pick_invoke(bContext *C, wmOperator *op, wmEv
selected = select_more_less_seq__internal(scene, 1, 1);
}
ED_area_tag_redraw(CTX_wm_area(C));
WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER_SELECT, scene);
return OPERATOR_FINISHED;
}
@ -716,7 +721,7 @@ static int sequencer_select_linked_exec(bContext *C, wmOperator *op)
selected = select_more_less_seq__internal(scene, 1, 1);
}
ED_area_tag_redraw(CTX_wm_area(C));
WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER_SELECT, scene);
return OPERATOR_FINISHED;
}
@ -768,7 +773,7 @@ static int sequencer_select_handles_exec(bContext *C, wmOperator *op)
}
}
ED_area_tag_redraw(CTX_wm_area(C));
WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER_SELECT, scene);
return OPERATOR_FINISHED;
}
@ -805,7 +810,7 @@ static int sequencer_select_active_side_exec(bContext *C, wmOperator *op)
select_active_side(ed->seqbasep, RNA_enum_get(op->ptr, "side"), seq_act->machine, seq_act->startdisp);
ED_area_tag_redraw(CTX_wm_area(C));
WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER_SELECT, scene);
return OPERATOR_FINISHED;
}

View File

@ -232,6 +232,7 @@ static void sequencer_main_area_listener(ARegion *ar, wmNotifier *wmn)
case ND_FRAME:
case ND_MARKERS:
case ND_SEQUENCER:
case ND_SEQUENCER_SELECT:
ED_region_tag_redraw(ar);
break;
}
@ -266,6 +267,7 @@ static void sequencer_buttons_area_listener(ARegion *ar, wmNotifier *wmn)
switch(wmn->data) {
case ND_FRAME:
case ND_SEQUENCER:
case ND_SEQUENCER_SELECT:
ED_region_tag_redraw(ar);
break;
}

View File

@ -735,9 +735,6 @@ void TEXT_OT_paste(wmOperatorType *ot)
ot->exec= paste_exec;
ot->poll= text_edit_poll;
/* flags */
ot->flag= OPTYPE_REGISTER;
/* properties */
RNA_def_boolean(ot->srna, "selection", 0, "Selection", "Paste text selected elsewhere rather than copied, X11 only.");
}
@ -806,9 +803,6 @@ void TEXT_OT_cut(wmOperatorType *ot)
/* api callbacks */
ot->exec= cut_exec;
ot->poll= text_edit_poll;
/* flags */
ot->flag= OPTYPE_REGISTER;
}
/******************* indent operator *********************/
@ -842,9 +836,6 @@ void TEXT_OT_indent(wmOperatorType *ot)
/* api callbacks */
ot->exec= indent_exec;
ot->poll= text_edit_poll;
/* flags */
ot->flag= OPTYPE_REGISTER;
}
/******************* unindent operator *********************/
@ -878,9 +869,6 @@ void TEXT_OT_unindent(wmOperatorType *ot)
/* api callbacks */
ot->exec= unindent_exec;
ot->poll= text_edit_poll;
/* flags */
ot->flag= OPTYPE_REGISTER;
}
/******************* line break operator *********************/
@ -919,9 +907,6 @@ void TEXT_OT_line_break(wmOperatorType *ot)
/* api callbacks */
ot->exec= line_break_exec;
ot->poll= text_edit_poll;
/* flags */
ot->flag= OPTYPE_REGISTER;
}
/******************* comment operator *********************/
@ -952,9 +937,6 @@ void TEXT_OT_comment(wmOperatorType *ot)
/* api callbacks */
ot->exec= comment_exec;
ot->poll= text_edit_poll;
/* flags */
ot->flag= OPTYPE_REGISTER;
}
/******************* uncomment operator *********************/
@ -986,9 +968,6 @@ void TEXT_OT_uncomment(wmOperatorType *ot)
/* api callbacks */
ot->exec= uncomment_exec;
ot->poll= text_edit_poll;
/* flags */
ot->flag= OPTYPE_REGISTER;
}
/******************* convert whitespace operator *********************/
@ -1129,9 +1108,6 @@ void TEXT_OT_convert_whitespace(wmOperatorType *ot)
ot->exec= convert_whitespace_exec;
ot->poll= text_edit_poll;
/* flags */
ot->flag= OPTYPE_REGISTER;
/* properties */
RNA_def_enum(ot->srna, "type", whitespace_type_items, TO_SPACES, "type", "Type of whitespace to convert to.");
}
@ -1159,9 +1135,6 @@ void TEXT_OT_select_all(wmOperatorType *ot)
/* api callbacks */
ot->exec= select_all_exec;
ot->poll= text_edit_poll;
/* flags */
ot->flag= OPTYPE_REGISTER;
}
/******************* select line operator *********************/
@ -1187,9 +1160,6 @@ void TEXT_OT_select_line(wmOperatorType *ot)
/* api clinebacks */
ot->exec= select_line_exec;
ot->poll= text_edit_poll;
/* flags */
ot->flag= OPTYPE_REGISTER;
}
/******************* previous marker operator *********************/
@ -1225,9 +1195,6 @@ void TEXT_OT_previous_marker(wmOperatorType *ot)
/* api callbacks */
ot->exec= previous_marker_exec;
ot->poll= text_edit_poll;
/* flags */
ot->flag= OPTYPE_REGISTER;
}
/******************* next marker operator *********************/
@ -1263,9 +1230,6 @@ void TEXT_OT_next_marker(wmOperatorType *ot)
/* api callbacks */
ot->exec= next_marker_exec;
ot->poll= text_edit_poll;
/* flags */
ot->flag= OPTYPE_REGISTER;
}
/******************* clear all markers operator *********************/
@ -1291,9 +1255,6 @@ void TEXT_OT_markers_clear(wmOperatorType *ot)
/* api callbacks */
ot->exec= clear_all_markers_exec;
ot->poll= text_edit_poll;
/* flags */
ot->flag= OPTYPE_REGISTER;
}
/************************ move operator ************************/
@ -1576,9 +1537,6 @@ void TEXT_OT_move(wmOperatorType *ot)
ot->exec= move_exec;
ot->poll= text_edit_poll;
/* flags */
ot->flag= OPTYPE_REGISTER;
/* properties */
RNA_def_enum(ot->srna, "type", move_type_items, LINE_BEGIN, "Type", "Where to move cursor to.");
}
@ -1603,9 +1561,6 @@ void TEXT_OT_move_select(wmOperatorType *ot)
ot->exec= move_select_exec;
ot->poll= text_space_edit_poll;
/* flags */
ot->flag= OPTYPE_REGISTER;
/* properties */
RNA_def_enum(ot->srna, "type", move_type_items, LINE_BEGIN, "Type", "Where to move cursor to, to make a selection.");
}
@ -1640,9 +1595,6 @@ void TEXT_OT_jump(wmOperatorType *ot)
ot->exec= jump_exec;
ot->poll= text_edit_poll;
/* flags */
ot->flag= OPTYPE_REGISTER;
/* properties */
RNA_def_int(ot->srna, "line", 1, 1, INT_MAX, "Line", "Line number to jump to.", 1, 10000);
}
@ -1693,9 +1645,6 @@ void TEXT_OT_delete(wmOperatorType *ot)
ot->exec= delete_exec;
ot->poll= text_edit_poll;
/* flags */
ot->flag= OPTYPE_REGISTER;
/* properties */
RNA_def_enum(ot->srna, "type", delete_type_items, DEL_NEXT_CHAR, "Type", "Which part of the text to delete.");
}
@ -1721,9 +1670,6 @@ void TEXT_OT_overwrite_toggle(wmOperatorType *ot)
/* api callbacks */
ot->exec= toggle_overwrite_exec;
ot->poll= text_space_edit_poll;
/* flags */
ot->flag= OPTYPE_REGISTER;
}
/******************* scroll operator **********************/
@ -2208,9 +2154,6 @@ void TEXT_OT_cursor_set(wmOperatorType *ot)
ot->cancel= set_cursor_cancel;
ot->poll= text_region_edit_poll;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_BLOCKING;
/* properties */
RNA_def_boolean(ot->srna, "select", 0, "Select", "Set selection end rather than cursor.");
}
@ -2332,9 +2275,6 @@ void TEXT_OT_insert(wmOperatorType *ot)
ot->invoke= insert_invoke;
ot->poll= text_edit_poll;
/* flags */
ot->flag= OPTYPE_REGISTER;
/* properties */
RNA_def_string(ot->srna, "text", "", 0, "Text", "Text to insert at the cursor position.");
}

View File

@ -3024,7 +3024,7 @@ static int drawDispListwire(ListBase *dlbase)
if(dlbase==NULL) return 1;
glDisableClientState(GL_NORMAL_ARRAY);
glEnableClientState(GL_VERTEX_ARRAY);
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
for(dl= dlbase->first; dl; dl= dl->next) {
@ -3101,7 +3101,7 @@ static int drawDispListwire(ListBase *dlbase)
}
}
glEnableClientState(GL_NORMAL_ARRAY);
glDisableClientState(GL_VERTEX_ARRAY);
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
return 0;
@ -3120,6 +3120,7 @@ static void drawDispListsolid(ListBase *lb, Object *ob, int glsl)
glGetFloatv(GL_CURRENT_COLOR, curcol);
glEnable(GL_LIGHTING);
glEnableClientState(GL_VERTEX_ARRAY);
if(ob->transflag & OB_NEG_SCALE) glFrontFace(GL_CW);
else glFrontFace(GL_CCW);
@ -3178,10 +3179,12 @@ static void drawDispListsolid(ListBase *lb, Object *ob, int glsl)
if(dl->rt & CU_SMOOTH) glShadeModel(GL_SMOOTH);
else glShadeModel(GL_FLAT);
glEnableClientState(GL_NORMAL_ARRAY);
glVertexPointer(3, GL_FLOAT, 0, dl->verts);
glNormalPointer(GL_FLOAT, 0, dl->nors);
glDrawElements(GL_QUADS, 4*dl->totindex, GL_UNSIGNED_INT, dl->index);
glDisableClientState(GL_NORMAL_ARRAY);
}
break;
@ -3191,32 +3194,35 @@ static void drawDispListsolid(ListBase *lb, Object *ob, int glsl)
glVertexPointer(3, GL_FLOAT, 0, dl->verts);
/* voor polys only one normal needed */
if(index3_nors_incr==0) {
glDisableClientState(GL_NORMAL_ARRAY);
glNormal3fv(ndata);
if(index3_nors_incr) {
glEnableClientState(GL_NORMAL_ARRAY);
glNormalPointer(GL_FLOAT, 0, dl->nors);
}
else
glNormalPointer(GL_FLOAT, 0, dl->nors);
glNormal3fv(ndata);
glDrawElements(GL_TRIANGLES, 3*dl->parts, GL_UNSIGNED_INT, dl->index);
if(index3_nors_incr==0)
glEnableClientState(GL_NORMAL_ARRAY);
if(index3_nors_incr)
glDisableClientState(GL_NORMAL_ARRAY);
break;
case DL_INDEX4:
GPU_enable_material(dl->col+1, (glsl)? &gattribs: NULL);
glEnableClientState(GL_NORMAL_ARRAY);
glVertexPointer(3, GL_FLOAT, 0, dl->verts);
glNormalPointer(GL_FLOAT, 0, dl->nors);
glDrawElements(GL_QUADS, 4*dl->parts, GL_UNSIGNED_INT, dl->index);
glDisableClientState(GL_NORMAL_ARRAY);
break;
}
dl= dl->next;
}
glDisableClientState(GL_VERTEX_ARRAY);
glShadeModel(GL_FLAT);
glDisable(GL_LIGHTING);
glFrontFace(GL_CCW);
@ -3230,7 +3236,7 @@ static void drawDispListshaded(ListBase *lb, Object *ob)
if(lb==NULL) return;
glShadeModel(GL_SMOOTH);
glDisableClientState(GL_NORMAL_ARRAY);
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_COLOR_ARRAY);
dl= lb->first;
@ -3269,7 +3275,7 @@ static void drawDispListshaded(ListBase *lb, Object *ob)
}
glShadeModel(GL_FLAT);
glEnableClientState(GL_NORMAL_ARRAY);
glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_COLOR_ARRAY);
}
@ -4010,14 +4016,12 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
/* 6. */
glGetIntegerv(GL_POLYGON_MODE, polygonmode);
glDisableClientState(GL_NORMAL_ARRAY);
glEnableClientState(GL_VERTEX_ARRAY);
if(draw_as==PART_DRAW_PATH){
ParticleCacheKey **cache, *path;
float *cd2=0,*cdata2=0;
glEnableClientState(GL_VERTEX_ARRAY);
/* setup gl flags */
if(ob_dt > OB_WIRE) {
glEnableClientState(GL_NORMAL_ARRAY);
@ -4145,7 +4149,6 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
glDisableClientState(GL_COLOR_ARRAY);
cpack(0xC0C0C0);
glEnableClientState(GL_VERTEX_ARRAY);
glVertexPointer(3, GL_FLOAT, 0, pdd->vedata);
glDrawArrays(GL_LINES, 0, 2*totve);
@ -4158,7 +4161,8 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
glDisable(GL_LIGHTING);
glDisableClientState(GL_COLOR_ARRAY);
glEnableClientState(GL_NORMAL_ARRAY);
glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_NORMAL_ARRAY);
if(states)
MEM_freeN(states);
@ -4223,7 +4227,6 @@ static void draw_ptcache_edit(Scene *scene, View3D *v3d, RegionView3D *rv3d, Obj
}
glEnableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_NORMAL_ARRAY);
glEnableClientState(GL_COLOR_ARRAY);
glEnable(GL_COLOR_MATERIAL);
@ -4333,7 +4336,8 @@ static void draw_ptcache_edit(Scene *scene, View3D *v3d, RegionView3D *rv3d, Obj
glDisable(GL_LIGHTING);
glDisable(GL_COLOR_MATERIAL);
glDisableClientState(GL_COLOR_ARRAY);
glEnableClientState(GL_NORMAL_ARRAY);
glDisableClientState(GL_NORMAL_ARRAY);
glDisableClientState(GL_VERTEX_ARRAY);
glEnable(GL_DEPTH_TEST);
glLineWidth(1.0f);

View File

@ -1918,7 +1918,7 @@ void ED_view3d_draw_offscreen(Scene *scene, View3D *v3d, ARegion *ar, int winx,
Base *base;
int bwinx, bwiny;
wmPushMatrix();
glPushMatrix();
/* set temporary new size */
bwinx= ar->winx;
@ -1993,7 +1993,7 @@ void ED_view3d_draw_offscreen(Scene *scene, View3D *v3d, ARegion *ar, int winx,
ar->winx= bwinx;
ar->winy= bwiny;
wmPopMatrix();
glPopMatrix();
}
void view3d_main_area_draw(const bContext *C, ARegion *ar)

View File

@ -236,11 +236,14 @@ typedef struct ViewOpsData {
float oldquat[4];
float trackvec[3];
float ofs[3], obofs[3];
float reverse, dist0;
float grid, far;
short axis_snap; /* view rotate only */
/* use for orbit selection and auto-dist */
float ofs[3], dyn_ofs[3];
short use_dyn_ofs;
int origx, origy, oldx, oldy;
int origkey; /* the key that triggered the operator */
@ -292,14 +295,56 @@ static void viewops_data_create(bContext *C, wmOperator *op, wmEvent *event)
vod->origx= vod->oldx= event->x;
vod->origy= vod->oldy= event->y;
vod->origkey= event->type; /* the key that triggered the operator. */
if (U.uiflag & USER_ORBIT_SELECTION)
{
vod->use_dyn_ofs= (U.uiflag & USER_ORBIT_SELECTION) ? 1:0;
if (vod->use_dyn_ofs) {
VECCOPY(vod->ofs, rv3d->ofs);
/* If there's no selection, lastofs is unmodified and last value since static */
calculateTransformCenter(C, event, V3D_CENTROID, lastofs);
VECCOPY(vod->obofs, lastofs);
mul_v3_fl(vod->obofs, -1.0f);
VECCOPY(vod->dyn_ofs, lastofs);
mul_v3_fl(vod->dyn_ofs, -1.0f);
}
else if (U.uiflag & USER_ORBIT_ZBUF) {
view3d_operator_needs_opengl(C); /* needed for zbuf drawing */
if((vod->use_dyn_ofs=view_autodist(CTX_data_scene(C), vod->ar, v3d, event->mval, vod->dyn_ofs))) {
if (rv3d->persp==RV3D_PERSP) {
float my_origin[3]; /* original G.vd->ofs */
float my_pivot[3]; /* view */
float dvec[3];
// locals for dist correction
float mat[3][3];
float upvec[3];
VECCOPY(my_origin, rv3d->ofs);
negate_v3(my_origin); /* ofs is flipped */
/* Set the dist value to be the distance from this 3d point */
/* this means youll always be able to zoom into it and panning wont go bad when dist was zero */
/* remove dist value */
upvec[0] = upvec[1] = 0;
upvec[2] = rv3d->dist;
copy_m3_m4(mat, rv3d->viewinv);
mul_m3_v3(mat, upvec);
sub_v3_v3v3(my_pivot, rv3d->ofs, upvec);
negate_v3(my_pivot); /* ofs is flipped */
/* find a new ofs value that is allong the view axis (rather then the mouse location) */
closest_to_line_v3(dvec, vod->dyn_ofs, my_pivot, my_origin);
vod->dist0 = rv3d->dist = len_v3v3(my_pivot, dvec);
negate_v3(dvec);
VECCOPY(rv3d->ofs, dvec);
}
negate_v3(vod->dyn_ofs);
VECCOPY(vod->ofs, rv3d->ofs);
} else {
vod->ofs[0] = vod->ofs[1] = vod->ofs[2] = 0.0f;
}
}
/* lookup, we dont pass on v3d to prevent confusement */
@ -428,7 +473,6 @@ void viewrotate_modal_keymap(wmKeyConfig *keyconf)
static void viewrotate_apply(ViewOpsData *vod, int x, int y)
{
RegionView3D *rv3d= vod->rv3d;
int use_sel= U.uiflag & USER_ORBIT_SELECTION;
rv3d->view= 0; /* need to reset everytime because of view snapping */
@ -464,7 +508,7 @@ static void viewrotate_apply(ViewOpsData *vod, int x, int y)
q1[3]*= si;
mul_qt_qtqt(rv3d->viewquat, q1, vod->oldquat);
if (use_sel) {
if (vod->use_dyn_ofs) {
/* compute the post multiplication quat, to rotate the offset correctly */
QUATCOPY(q1, vod->oldquat);
conjugate_qt(q1);
@ -472,9 +516,9 @@ static void viewrotate_apply(ViewOpsData *vod, int x, int y)
conjugate_qt(q1); /* conj == inv for unit quat */
VECCOPY(rv3d->ofs, vod->ofs);
sub_v3_v3v3(rv3d->ofs, rv3d->ofs, vod->obofs);
sub_v3_v3v3(rv3d->ofs, rv3d->ofs, vod->dyn_ofs);
mul_qt_v3(q1, rv3d->ofs);
add_v3_v3v3(rv3d->ofs, rv3d->ofs, vod->obofs);
add_v3_v3v3(rv3d->ofs, rv3d->ofs, vod->dyn_ofs);
}
}
else {
@ -506,11 +550,11 @@ static void viewrotate_apply(ViewOpsData *vod, int x, int y)
q1[3] = si * xvec[2];
mul_qt_qtqt(rv3d->viewquat, rv3d->viewquat, q1);
if (use_sel) {
if (vod->use_dyn_ofs) {
conjugate_qt(q1); /* conj == inv for unit quat */
sub_v3_v3v3(rv3d->ofs, rv3d->ofs, vod->obofs);
sub_v3_v3v3(rv3d->ofs, rv3d->ofs, vod->dyn_ofs);
mul_qt_v3(q1, rv3d->ofs);
add_v3_v3v3(rv3d->ofs, rv3d->ofs, vod->obofs);
add_v3_v3v3(rv3d->ofs, rv3d->ofs, vod->dyn_ofs);
}
/* Perform the orbital rotation */
@ -520,11 +564,11 @@ static void viewrotate_apply(ViewOpsData *vod, int x, int y)
q1[3] = sin(phi);
mul_qt_qtqt(rv3d->viewquat, rv3d->viewquat, q1);
if (use_sel) {
if (vod->use_dyn_ofs) {
conjugate_qt(q1);
sub_v3_v3v3(rv3d->ofs, rv3d->ofs, vod->obofs);
sub_v3_v3v3(rv3d->ofs, rv3d->ofs, vod->dyn_ofs);
mul_qt_v3(q1, rv3d->ofs);
add_v3_v3v3(rv3d->ofs, rv3d->ofs, vod->obofs);
add_v3_v3v3(rv3d->ofs, rv3d->ofs, vod->dyn_ofs);
}
}

View File

@ -266,7 +266,7 @@ void view3d_keymap(wmKeyConfig *keyconf)
kmi = WM_keymap_add_item(keymap, "WM_OT_context_set_enum", PERIODKEY, KM_PRESS, KM_CTRL, 0);
RNA_string_set(kmi->ptr, "path", "space_data.pivot_point");
RNA_string_set(kmi->ptr, "value", "INDIVIDUAL_CENTERS");
RNA_string_set(kmi->ptr, "value", "INDIVIDUAL_ORIGINS");
kmi = WM_keymap_add_item(keymap, "WM_OT_context_set_enum", PERIODKEY, KM_PRESS, KM_ALT, 0);
RNA_string_set(kmi->ptr, "path", "space_data.pivot_point");

View File

@ -2212,7 +2212,7 @@ static void createTransEditVerts(bContext *C, TransInfo *t)
/* detect CrazySpace [tm] */
if(propmode==0) {
if(modifiers_getCageIndex(t->obedit, NULL, 1)>=0) {
if(modifiers_isDeformed(t->scene, t->obedit)) {
if(modifiers_isCorrectableDeformed(t->scene, t->obedit)) {
/* check if we can use deform matrices for modifier from the
start up to stack, they are more accurate than quats */
totleft= editmesh_get_first_deform_matrices(t->obedit, em, &defmats, &defcos);
@ -2371,7 +2371,7 @@ void flushTransSeq(TransInfo *t)
switch (tdsq->sel_flag) {
case SELECT:
if (seq->type != SEQ_META && seq_tx_test(seq)) /* for meta's, their children move */
if (seq->type != SEQ_META && (seq->depth != 0 || seq_tx_test(seq))) /* for meta's, their children move */
seq->start= new_frame - tdsq->start_offset;
if (seq->depth==0) {

View File

@ -273,23 +273,6 @@ static void editmesh_apply_to_mirror(TransInfo *t)
}
}
/* tags the given ID block for refreshes (if applicable) due to
* Animation Editor editing
*/
static void animedit_refresh_id_tags (Scene *scene, ID *id)
{
if (id) {
AnimData *adt= BKE_animdata_from_id(id);
/* tag AnimData for refresh so that other views will update in realtime with these changes */
if (adt)
adt->recalc |= ADT_RECALC_ANIM;
/* set recalc flags */
DAG_id_flush_update(id, OB_RECALC); // XXX or do we want something more restrictive?
}
}
/* for the realtime animation recording feature, handle overlapping data */
static void animrecord_check_state (Scene *scene, ID *id, wmTimer *animtimer)
{
@ -378,7 +361,7 @@ void recalcData(TransInfo *t)
/* just tag these animdata-blocks to recalc, assuming that some data there changed */
for (ale= anim_data.first; ale; ale= ale->next) {
/* set refresh tags for objects using this animation */
animedit_refresh_id_tags(t->scene, ale->id);
ANIM_list_elem_update(t->scene, ale);
}
/* now free temp channels */
@ -426,7 +409,7 @@ void recalcData(TransInfo *t)
calchandles_fcurve(fcu);
/* set refresh tags for objects using this animation */
animedit_refresh_id_tags(t->scene, ale->id);
ANIM_list_elem_update(t->scene, ale);
}
/* do resort and other updates? */
@ -457,7 +440,7 @@ void recalcData(TransInfo *t)
continue;
/* set refresh tags for objects using this animation */
animedit_refresh_id_tags(t->scene, tdn->id);
ANIM_id_update(t->scene, tdn->id);
/* if cancelling transform, just write the values without validating, then move on */
if (t->state == TRANS_CANCEL) {

View File

@ -826,7 +826,7 @@ static int unwrap_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
handle= construct_param_handle(scene, em, 0, fill_holes, 0, correct_aspect);
handle= construct_param_handle(scene, em, 0, fill_holes, 1, correct_aspect);
param_lscm_begin(handle, PARAM_FALSE, method == 0);
param_lscm_solve(handle);

View File

@ -741,15 +741,9 @@ GPUBuffer *GPU_buffer_setup( DerivedMesh *dm, GPUDrawObject *object, int size, G
DEBUG_VBO("GPU_buffer_setup\n");
if( globalPool == 0 ) {
if( globalPool == 0 )
globalPool = GPU_buffer_pool_new();
/* somehow GL_NORMAL_ARRAY is enabled on startup and causes edge drawing code to crash */
glDisableClientState( GL_VERTEX_ARRAY );
glDisableClientState( GL_NORMAL_ARRAY );
glDisableClientState( GL_TEXTURE_COORD_ARRAY );
glDisableClientState( GL_COLOR_ARRAY );
}
buffer = GPU_buffer_alloc(size,globalPool);
if( buffer == 0 ) {
dm->drawObject->legacy = 1;

View File

@ -1276,9 +1276,11 @@ void GPU_state_init(void)
glDisable(GL_TEXTURE_1D);
glDisable(GL_TEXTURE_2D);
/* default on, disable/enable should be local per function */
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_NORMAL_ARRAY);
/* default disabled, enable should be local per function */
glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_NORMAL_ARRAY);
glDisableClientState(GL_COLOR_ARRAY);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
glPixelTransferi(GL_MAP_COLOR, GL_FALSE);
glPixelTransferi(GL_RED_SCALE, 1);

View File

@ -277,7 +277,7 @@ void IMB_rectclip(struct ImBuf *dbuf, struct ImBuf *sbuf, int *destx,
}
if (*srcx < 0) {
*destx -= *srcx;
*width += *destx;
*width += *srcx;
*srcx = 0;
}
if (*desty < 0) {
@ -287,7 +287,7 @@ void IMB_rectclip(struct ImBuf *dbuf, struct ImBuf *sbuf, int *destx,
}
if (*srcy < 0) {
*desty -= *srcy;
*height += *desty;
*height += *srcy;
*srcy = 0;
}

View File

@ -291,7 +291,8 @@ typedef struct ChannelDriver {
/* python expression to execute (may call functions defined in an accessory file)
* which relates the target 'variables' in some way to yield a single usable value
*/
char expression[256];
char expression[256];
void *expr_comp; /* PyObject - compiled expression, dont save this */
float curval; /* result of previous evaluation, for subtraction from result under certain circumstances */
float influence; /* influence of driver on result */ // XXX to be implemented... this is like the constraint influence setting
@ -309,6 +310,8 @@ typedef enum eDriver_Types {
DRIVER_TYPE_PYTHON,
/* rotational difference (must use rotation channels only) */
DRIVER_TYPE_ROTDIFF,
/* sum of all values */
DRIVER_TYPE_SUM,
} eDriver_Types;
/* driver flags */
@ -320,6 +323,8 @@ typedef enum eDriver_Flags {
/* driver does replace value, but overrides (for layering of animation over driver) */
// TODO: this needs to be implemented at some stage or left out...
DRIVER_FLAG_LAYERING = (1<<2),
DRIVER_FLAG_RECOMPILE = (1<<3), /* use when the expression needs to be recompiled */
} eDriver_Flags;
/* F-Curves -------------------------------------- */

View File

@ -170,9 +170,10 @@ typedef struct ARegion {
#define WIN_EQUAL 3
/* area->flag */
#define HEADER_NO_PULLDOWN 1
#define AREA_FLAG_DRAWJOINTO 2
#define AREA_FLAG_DRAWJOINFROM 4
#define HEADER_NO_PULLDOWN 1
#define AREA_FLAG_DRAWJOINTO 2
#define AREA_FLAG_DRAWJOINFROM 4
#define AREA_TEMP_INFO 8
/* If you change EDGEWIDTH, also do the global arrat edcol[] */
#define EDGEWIDTH 1

View File

@ -141,7 +141,7 @@ typedef struct wmWindow {
int winid; /* winid also in screens, is for retrieving this window after read */
short grabcursor; /* 1 if cursor is grabbed */
short grabcursor; /* cursor grab mode */
short pad;
struct bScreen *screen; /* active screen */

View File

@ -38,6 +38,7 @@ struct bContext;
struct ID;
struct Main;
struct ReportList;
struct Scene;
/* Types */
@ -649,6 +650,7 @@ int RNA_property_animateable(PointerRNA *ptr, PropertyRNA *prop);
int RNA_property_animated(PointerRNA *ptr, PropertyRNA *prop);
void RNA_property_update(struct bContext *C, PointerRNA *ptr, PropertyRNA *prop);
void RNA_property_update_main(struct Main *bmain, struct Scene *scene, PointerRNA *ptr, PropertyRNA *prop);
/* Property Data */

View File

@ -166,6 +166,9 @@ typedef enum PropertyFlag {
/* flag contains multiple enums */
PROP_ENUM_FLAG = 1<<21,
/* need context for update function */
PROP_CONTEXT_UPDATE = 1<<22,
/* internal flags */
PROP_BUILTIN = 1<<7,
PROP_EXPORT = 1<<8,

View File

@ -1763,7 +1763,7 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr
rna_print_c_string(f, prop->description); fprintf(f, ",\n\t");
fprintf(f, "%d,\n", prop->icon);
fprintf(f, "\t%s, %s|%s, %s, %d, {%d, %d, %d}, %d,\n", rna_property_typename(prop->type), rna_property_subtypename(prop->subtype), rna_property_subtype_unit(prop->subtype), rna_function_string(prop->getlength), prop->arraydimension, prop->arraylength[0], prop->arraylength[1], prop->arraylength[2], prop->totarraylength);
fprintf(f, "\t%s, %d, %s, %s,\n", rna_function_string(prop->update), prop->noteflag, rna_function_string(prop->editable), rna_function_string(prop->itemeditable));
fprintf(f, "\t%s%s, %d, %s, %s,\n", (prop->flag & PROP_CONTEXT_UPDATE)? "(UpdateFunc)": "", rna_function_string(prop->update), prop->noteflag, rna_function_string(prop->editable), rna_function_string(prop->itemeditable));
if(prop->flag & PROP_RAW_ACCESS) rna_set_raw_offset(f, srna, prop);
else fprintf(f, "\t0, 0");
@ -2050,11 +2050,13 @@ static void rna_generate(BlenderRNA *brna, FILE *f, char *filename, char *api_fi
fprintf(f, "#include <stddef.h>\n\n");
fprintf(f, "#include \"DNA_ID.h\"\n");
fprintf(f, "#include \"DNA_scene_types.h\"\n");
fprintf(f, "#include \"BLI_blenlib.h\"\n\n");
fprintf(f, "#include \"BKE_context.h\"\n");
fprintf(f, "#include \"BKE_library.h\"\n");
fprintf(f, "#include \"BKE_main.h\"\n");
fprintf(f, "#include \"BKE_report.h\"\n");
fprintf(f, "#include \"BKE_utildefines.h\"\n\n");

View File

@ -29,6 +29,7 @@
#include "MEM_guardedalloc.h"
#include "DNA_ID.h"
#include "DNA_scene_types.h"
#include "DNA_windowmanager_types.h"
#include "BLI_blenlib.h"
@ -37,6 +38,7 @@
#include "BKE_context.h"
#include "BKE_idprop.h"
#include "BKE_main.h"
#include "BKE_report.h"
#include "BKE_utildefines.h"
@ -1103,23 +1105,41 @@ int RNA_property_animated(PointerRNA *ptr, PropertyRNA *prop)
return 0;
}
void RNA_property_update(bContext *C, PointerRNA *ptr, PropertyRNA *prop)
static void rna_property_update(bContext *C, Main *bmain, Scene *scene, PointerRNA *ptr, PropertyRNA *prop)
{
int is_rna = (prop->magic == RNA_MAGIC);
prop= rna_ensure_property(prop);
if(is_rna) {
if(prop->update)
prop->update(C, ptr);
if(prop->update) {
/* ideally no context would be needed for update, but there's some
parts of the code that need it still, so we have this exception */
if(prop->flag & PROP_CONTEXT_UPDATE) {
if(C) ((ContextUpdateFunc)prop->update)(C, ptr);
}
else
prop->update(bmain, scene, ptr);
}
if(prop->noteflag)
WM_event_add_notifier(C, prop->noteflag, ptr->id.data);
WM_main_add_notifier(prop->noteflag, ptr->id.data);
}
else {
/* WARNING! This is so property drivers update the display!
* not especially nice */
DAG_id_flush_update(ptr->id.data, OB_RECALC_OB);
WM_event_add_notifier(C, NC_WINDOW, NULL);
WM_main_add_notifier(NC_WINDOW, NULL);
}
}
void RNA_property_update(bContext *C, PointerRNA *ptr, PropertyRNA *prop)
{
rna_property_update(C, CTX_data_main(C), CTX_data_scene(C), ptr, prop);
}
void RNA_property_update_main(Main *bmain, Scene *scene, PointerRNA *ptr, PropertyRNA *prop)
{
rna_property_update(NULL, bmain, scene, ptr, prop);
}
/* Property Data */

View File

@ -144,13 +144,13 @@ static void rna_def_dopesheet(BlenderRNA *brna)
prop= RNA_def_property(srna, "include_missing_nla", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "filterflag", ADS_FILTER_NLA_NOACT);
RNA_def_property_ui_text(prop, "Include Missing NLA", "Include Animation Data blocks with no NLA Data.");
RNA_def_property_ui_text(prop, "Include Missing NLA", "Include Animation Data blocks with no NLA data. (NLA Editor only)");
RNA_def_property_ui_icon(prop, ICON_ACTION, 0);
RNA_def_property_update(prop, NC_ANIMATION|ND_ANIMCHAN_EDIT, NULL);
prop= RNA_def_property(srna, "collapse_summary", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", ADS_FLAG_SUMMARY_COLLAPSED);
RNA_def_property_ui_text(prop, "Collapse Summary", "Collapse summary when shown, so all other channels get hidden.");
RNA_def_property_ui_text(prop, "Collapse Summary", "Collapse summary when shown, so all other channels get hidden. (DopeSheet Window Editors Only)");
RNA_def_property_update(prop, NC_ANIMATION|ND_ANIMCHAN_EDIT, NULL);
}

View File

@ -46,14 +46,15 @@
#include "BKE_main.h"
#include "ED_armature.h"
#include "BKE_armature.h"
static void rna_Armature_update_data(bContext *C, PointerRNA *ptr)
static void rna_Armature_update_data(Main *bmain, Scene *scene, PointerRNA *ptr)
{
ID *id= ptr->id.data;
DAG_id_flush_update(id, OB_RECALC_DATA);
WM_event_add_notifier(C, NC_GEOM|ND_DATA, id);
//WM_event_add_notifier(C, NC_OBJECT|ND_POSE, NULL);
WM_main_add_notifier(NC_GEOM|ND_DATA, id);
//WM_main_add_notifier(NC_OBJECT|ND_POSE, NULL);
}
@ -103,11 +104,11 @@ void rna_Armature_edit_bone_remove(bArmature *arm, EditBone *ebone)
ED_armature_edit_bone_remove(arm, ebone);
}
static void rna_Armature_redraw_data(bContext *C, PointerRNA *ptr)
static void rna_Armature_redraw_data(Main *bmain, Scene *scene, PointerRNA *ptr)
{
ID *id= ptr->id.data;
WM_event_add_notifier(C, NC_GEOM|ND_DATA, id);
WM_main_add_notifier(NC_GEOM|ND_DATA, id);
}
static char *rna_Bone_path(PointerRNA *ptr)
@ -279,10 +280,6 @@ static void rna_EditBone_parent_set(PointerRNA *ptr, PointerRNA value)
EditBone *ebone= (EditBone*)(ptr->data);
EditBone *pbone, *parbone= (EditBone*)value.data;
/* within same armature */
if(value.id.data != ptr->id.data)
return;
if(parbone == NULL) {
if(ebone->parent && !(ebone->parent->flag & BONE_ROOTSEL))
ebone->parent->flag &= ~BONE_TIPSEL;
@ -291,6 +288,10 @@ static void rna_EditBone_parent_set(PointerRNA *ptr, PointerRNA value)
ebone->flag &= ~BONE_CONNECTED;
}
else {
/* within same armature */
if(value.id.data != ptr->id.data)
return;
/* make sure this is a valid child */
if(parbone == ebone)
return;
@ -304,7 +305,22 @@ static void rna_EditBone_parent_set(PointerRNA *ptr, PointerRNA value)
}
}
static void rna_Armature_editbone_transform_update(bContext *C, PointerRNA *ptr)
static void rna_EditBone_matrix_get(PointerRNA *ptr, float *values)
{
EditBone *ebone= (EditBone*)(ptr->data);
float delta[3], tmat[3][3], mat[4][4];
/* Find the current bone matrix */
sub_v3_v3v3(delta, ebone->tail, ebone->head);
vec_roll_to_mat3(delta, ebone->roll, tmat);
copy_m4_m3(mat, tmat);
VECCOPY(mat[3], ebone->head);
memcpy(values, mat, 16 * sizeof(float));
}
static void rna_Armature_editbone_transform_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
bArmature *arm= (bArmature*)ptr->id.data;
EditBone *ebone= (EditBone*)ptr->data;
@ -339,7 +355,7 @@ static void rna_Armature_editbone_transform_update(bContext *C, PointerRNA *ptr)
}
}
rna_Armature_update_data(C, ptr);
rna_Armature_update_data(bmain, scene, ptr);
}
static void rna_Armature_bones_next(CollectionPropertyIterator *iter)
@ -618,6 +634,14 @@ static void rna_def_edit_bone(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Tail Selected", "");
RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
/* calculated and read only, not actual data access */
prop= RNA_def_property(srna, "matrix", PROP_FLOAT, PROP_MATRIX);
//RNA_def_property_float_sdna(prop, NULL, ""); // doesnt access any real data
RNA_def_property_array(prop, 16);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Editbone Matrix", "Read-only matrix calculated from the roll (armature space).");
RNA_def_property_float_funcs(prop, "rna_EditBone_matrix_get", NULL, NULL); // TODO - this could be made writable also
RNA_api_armature_edit_bone(srna);
RNA_define_verify_sdna(1);

View File

@ -72,7 +72,7 @@ EnumPropertyItem boidruleset_type_items[] ={
#include "BKE_depsgraph.h"
#include "BKE_particle.h"
static void rna_Boids_reset(bContext *C, PointerRNA *ptr)
static void rna_Boids_reset(Main *bmain, Scene *scene, PointerRNA *ptr)
{
if(ptr->type==&RNA_ParticleSystem) {
ParticleSystem *psys = (ParticleSystem*)ptr->data;
@ -84,12 +84,10 @@ static void rna_Boids_reset(bContext *C, PointerRNA *ptr)
else
DAG_id_flush_update(ptr->id.data, OB_RECALC_DATA|PSYS_RECALC_RESET);
WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE_DATA, NULL);
WM_main_add_notifier(NC_OBJECT|ND_PARTICLE_DATA, NULL);
}
static void rna_Boids_reset_deps(bContext *C, PointerRNA *ptr)
static void rna_Boids_reset_deps(Main *bmain, Scene *scene, PointerRNA *ptr)
{
Scene *scene = CTX_data_scene(C);
if(ptr->type==&RNA_ParticleSystem) {
ParticleSystem *psys = (ParticleSystem*)ptr->data;
@ -102,7 +100,7 @@ static void rna_Boids_reset_deps(bContext *C, PointerRNA *ptr)
DAG_scene_sort(scene);
WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE_DATA, NULL);
WM_main_add_notifier(NC_OBJECT|ND_PARTICLE_DATA, NULL);
}
static StructRNA* rna_BoidRule_refine(struct PointerRNA *ptr)

View File

@ -76,10 +76,10 @@ static void rna_Brush_active_texture_set(PointerRNA *ptr, PointerRNA value)
set_current_brush_texture(br, value.data);
}
static void rna_Brush_update(bContext *C, PointerRNA *ptr)
static void rna_Brush_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
Brush *br= (Brush*)ptr->data;
WM_event_add_notifier(C, NC_BRUSH|NA_EDITED, br);
WM_main_add_notifier(NC_BRUSH|NA_EDITED, br);
}
static float rna_BrushTextureSlot_angle_get(PointerRNA *ptr)

View File

@ -37,13 +37,13 @@
#ifdef RNA_RUNTIME
static void rna_Camera_angle_update(bContext *C, PointerRNA *ptr)
static void rna_Camera_angle_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
Camera *cam= (Camera*)ptr->id.data;
cam->lens = 16.0f / tan(M_PI*cam->angle/360.0f);
}
static void rna_Camera_lens_update(bContext *C, PointerRNA *ptr)
static void rna_Camera_lens_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
Camera *cam= (Camera*)ptr->id.data;
cam->angle= 360.0f * atan(16.0f/cam->lens) / M_PI;

View File

@ -45,15 +45,15 @@
#include "BKE_context.h"
#include "BKE_depsgraph.h"
static void rna_cloth_update(bContext *C, PointerRNA *ptr)
static void rna_cloth_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
Object *ob= (Object*)ptr->id.data;
DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob);
WM_main_add_notifier(NC_OBJECT|ND_MODIFIER, ob);
}
static void rna_cloth_reset(bContext *C, PointerRNA *ptr)
static void rna_cloth_reset(Main *bmain, Scene *scene, PointerRNA *ptr)
{
Object *ob= (Object*)ptr->id.data;
ClothSimSettings *settings = (ClothSimSettings*)ptr->data;
@ -61,7 +61,7 @@ static void rna_cloth_reset(bContext *C, PointerRNA *ptr)
settings->reset = 1;
DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob);
WM_main_add_notifier(NC_OBJECT|ND_MODIFIER, ob);
}

View File

@ -198,24 +198,24 @@ static char *rna_Constraint_path(PointerRNA *ptr)
return BLI_sprintfN("constraints[\"%s\"]", con->name);
}
static void rna_Constraint_update(bContext *C, PointerRNA *ptr)
static void rna_Constraint_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
ED_object_constraint_update(ptr->id.data);
}
static void rna_Constraint_dependency_update(bContext *C, PointerRNA *ptr)
static void rna_Constraint_dependency_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
ED_object_constraint_dependency_update(CTX_data_scene(C), ptr->id.data);
ED_object_constraint_dependency_update(scene, ptr->id.data);
}
static void rna_Constraint_influence_update(bContext *C, PointerRNA *ptr)
static void rna_Constraint_influence_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
Object *ob= ptr->id.data;
if(ob->pose)
ob->pose->flag |= (POSE_LOCKED|POSE_DO_UNLOCK);
rna_Constraint_update(C, ptr);
rna_Constraint_update(bmain, scene, ptr);
}
static void rna_Constraint_ik_type_set(struct PointerRNA *ptr, int value)

View File

@ -215,21 +215,21 @@ static void rna_BPoint_array_begin(CollectionPropertyIterator *iter, PointerRNA
rna_iterator_array_begin(iter, (void*)nu->bp, sizeof(BPoint), nu->pntsv>0 ? nu->pntsu*nu->pntsv : nu->pntsu, 0, NULL);
}
static void rna_Curve_update_data(bContext *C, PointerRNA *ptr)
static void rna_Curve_update_data(Main *bmain, Scene *scene, PointerRNA *ptr)
{
ID *id= ptr->id.data;
DAG_id_flush_update(id, OB_RECALC_DATA);
WM_event_add_notifier(C, NC_GEOM|ND_DATA, id);
WM_main_add_notifier(NC_GEOM|ND_DATA, id);
}
static void rna_Curve_update_deps(bContext *C, PointerRNA *ptr)
static void rna_Curve_update_deps(Main *bmain, Scene *scene, PointerRNA *ptr)
{
DAG_scene_sort(CTX_data_scene(C));
rna_Curve_update_data(C, ptr);
DAG_scene_sort(scene);
rna_Curve_update_data(bmain, scene, ptr);
}
static void rna_Curve_resolution_u_update_data(bContext *C, PointerRNA *ptr)
static void rna_Curve_resolution_u_update_data(Main *bmain, Scene *scene, PointerRNA *ptr)
{
Curve *cu= (Curve*)ptr->id.data;
Nurb *nu=NULL;
@ -242,10 +242,10 @@ static void rna_Curve_resolution_u_update_data(bContext *C, PointerRNA *ptr)
nu= nu->next;
}
rna_Curve_update_data(C, ptr);
rna_Curve_update_data(bmain, scene, ptr);
}
static void rna_Curve_resolution_v_update_data(bContext *C, PointerRNA *ptr)
static void rna_Curve_resolution_v_update_data(Main *bmain, Scene *scene, PointerRNA *ptr)
{
Curve *cu= (Curve*)ptr->id.data;
Nurb *nu=NULL;
@ -258,7 +258,7 @@ static void rna_Curve_resolution_v_update_data(bContext *C, PointerRNA *ptr)
nu= nu->next;
}
rna_Curve_update_data(C, ptr);
rna_Curve_update_data(bmain, scene, ptr);
}
/* name functions that ignore the first two ID characters */
@ -293,34 +293,34 @@ void rna_Curve_body_set(PointerRNA *ptr, const char *value)
BLI_strncpy(cu->str, value, len+1);
}
static void rna_Nurb_update_handle_data(bContext *C, PointerRNA *ptr)
static void rna_Nurb_update_handle_data(Main *bmain, Scene *scene, PointerRNA *ptr)
{
Nurb *nu= (Nurb*)ptr->data;
if(nu->type == CU_BEZIER)
calchandlesNurb(nu);
rna_Curve_update_data(C, ptr);
rna_Curve_update_data(bmain, scene, ptr);
}
static void rna_Nurb_update_knot_u(bContext *C, PointerRNA *ptr)
static void rna_Nurb_update_knot_u(Main *bmain, Scene *scene, PointerRNA *ptr)
{
Nurb *nu= (Nurb*)ptr->data;
clamp_nurb_order_u(nu);
makeknots(nu, 1);
rna_Curve_update_data(C, ptr);
rna_Curve_update_data(bmain, scene, ptr);
}
static void rna_Nurb_update_knot_v(bContext *C, PointerRNA *ptr)
static void rna_Nurb_update_knot_v(Main *bmain, Scene *scene, PointerRNA *ptr)
{
Nurb *nu= (Nurb*)ptr->data;
clamp_nurb_order_v(nu);
makeknots(nu, 2);
rna_Curve_update_data(C, ptr);
rna_Curve_update_data(bmain, scene, ptr);
}
#else

View File

@ -91,7 +91,7 @@ static StructRNA *rna_FModifierType_refine(struct PointerRNA *ptr)
#include "BKE_depsgraph.h"
#include "BKE_animsys.h"
static void rna_ChannelDriver_update_data(bContext *C, PointerRNA *ptr)
static void rna_ChannelDriver_update_data(Main *bmain, Scene *scene, PointerRNA *ptr)
{
ID *id= ptr->id.data;
ChannelDriver *driver= ptr->data;
@ -99,13 +99,20 @@ static void rna_ChannelDriver_update_data(bContext *C, PointerRNA *ptr)
driver->flag &= ~DRIVER_FLAG_INVALID;
// TODO: this really needs an update guard...
DAG_scene_sort(CTX_data_scene(C));
DAG_scene_sort(scene);
DAG_id_flush_update(id, OB_RECALC_OB|OB_RECALC_DATA);
WM_event_add_notifier(C, NC_SCENE|ND_FRAME, CTX_data_scene(C));
WM_main_add_notifier(NC_SCENE|ND_FRAME, scene);
}
static void rna_DriverTarget_update_data(bContext *C, PointerRNA *ptr)
static void rna_ChannelDriver_update_expr(Main *bmain, Scene *scene, PointerRNA *ptr)
{
ChannelDriver *driver= ptr->data;
driver->flag |= DRIVER_FLAG_RECOMPILE;
rna_ChannelDriver_update_data(bmain, scene, ptr);
}
static void rna_DriverTarget_update_data(Main *bmain, Scene *scene, PointerRNA *ptr)
{
PointerRNA driverptr;
ChannelDriver *driver;
@ -118,7 +125,7 @@ static void rna_DriverTarget_update_data(bContext *C, PointerRNA *ptr)
if(driver && BLI_findindex(&driver->targets, ptr->data) != -1) {
RNA_pointer_create(ptr->id.data, &RNA_Driver, driver, &driverptr);
rna_ChannelDriver_update_data(C, &driverptr);
rna_ChannelDriver_update_data(bmain, scene, &driverptr);
return;
}
}
@ -260,7 +267,7 @@ static void rna_FModifier_active_set(PointerRNA *ptr, int value)
fm->flag |= FMODIFIER_FLAG_ACTIVE;
}
static void rna_FModifier_active_update(bContext *C, PointerRNA *ptr)
static void rna_FModifier_active_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
FModifier *fm, *fmo= (FModifier*)ptr->data;
@ -789,6 +796,7 @@ static void rna_def_channeldriver(BlenderRNA *brna)
static EnumPropertyItem prop_type_items[] = {
{DRIVER_TYPE_AVERAGE, "AVERAGE", 0, "Averaged Value", ""},
{DRIVER_TYPE_SUM, "SUM", 0, "Sum Values", ""},
{DRIVER_TYPE_PYTHON, "SCRIPTED", 0, "Scripted Expression", ""},
{DRIVER_TYPE_ROTDIFF, "ROTDIFF", 0, "Rotational Difference", ""},
{0, NULL, 0, NULL, NULL}};
@ -806,7 +814,7 @@ static void rna_def_channeldriver(BlenderRNA *brna)
/* String values */
prop= RNA_def_property(srna, "expression", PROP_STRING, PROP_NONE);
RNA_def_property_ui_text(prop, "Expression", "Expression to use for Scripted Expression.");
RNA_def_property_update(prop, 0, "rna_ChannelDriver_update_data");
RNA_def_property_update(prop, 0, "rna_ChannelDriver_update_expr");
/* Collections */
prop= RNA_def_property(srna, "targets", PROP_COLLECTION, PROP_NONE);

View File

@ -72,17 +72,16 @@ static StructRNA* rna_FluidSettings_refine(struct PointerRNA *ptr)
}
}
static void rna_fluid_update(bContext *C, PointerRNA *ptr)
static void rna_fluid_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
Object *ob= ptr->id.data;
DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob);
WM_main_add_notifier(NC_OBJECT|ND_MODIFIER, ob);
}
static void rna_FluidSettings_update_type(bContext *C, PointerRNA *ptr)
static void rna_FluidSettings_update_type(Main *bmain, Scene *scene, PointerRNA *ptr)
{
Main *bmain= CTX_data_main(C);
Object *ob= (Object*)ptr->id.data;
FluidsimModifierData *fluidmd;
ParticleSystemModifierData *psmd;
@ -132,7 +131,7 @@ static void rna_FluidSettings_update_type(bContext *C, PointerRNA *ptr)
}
}
rna_fluid_update(C, ptr);
rna_fluid_update(bmain, scene, ptr);
}
static void rna_DomainFluidSettings_memory_estimate_get(PointerRNA *ptr, char *value)

View File

@ -56,7 +56,7 @@ static void rna_Group_objects_link(Group *group, bContext *C, ReportList *report
return;
}
WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, &object->id);
WM_main_add_notifier(NC_OBJECT|ND_DRAW, &object->id);
}
static void rna_Group_objects_unlink(Group *group, bContext *C, ReportList *reports, Object *object)
@ -66,7 +66,7 @@ static void rna_Group_objects_unlink(Group *group, bContext *C, ReportList *repo
return;
}
WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, &object->id);
WM_main_add_notifier(NC_OBJECT|ND_DRAW, &object->id);
}
#else

View File

@ -49,7 +49,7 @@ static EnumPropertyItem image_source_items[]= {
#include "IMB_imbuf_types.h"
static void rna_Image_animated_update(bContext *C, PointerRNA *ptr)
static void rna_Image_animated_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
Image *ima= (Image*)ptr->data;
int nr;
@ -74,13 +74,13 @@ static int rna_Image_dirty_get(PointerRNA *ptr)
return 0;
}
static void rna_Image_source_update(bContext *C, PointerRNA *ptr)
static void rna_Image_source_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
Image *ima= ptr->id.data;
BKE_image_signal(ima, NULL, IMA_SIGNAL_SRC_CHANGE);
}
static void rna_Image_fields_update(bContext *C, PointerRNA *ptr)
static void rna_Image_fields_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
Image *ima= ptr->id.data;
ImBuf *ibuf;
@ -101,22 +101,21 @@ static void rna_Image_fields_update(bContext *C, PointerRNA *ptr)
BKE_image_release_ibuf(ima, lock);
}
static void rna_Image_reload_update(bContext *C, PointerRNA *ptr)
static void rna_Image_reload_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
Image *ima= ptr->id.data;
BKE_image_signal(ima, NULL, IMA_SIGNAL_RELOAD);
printf("reload %p\n", ima);
}
static void rna_Image_generated_update(bContext *C, PointerRNA *ptr)
static void rna_Image_generated_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
Image *ima= ptr->id.data;
BKE_image_signal(ima, NULL, IMA_SIGNAL_FREE);
}
static void rna_ImageUser_update(bContext *C, PointerRNA *ptr)
static void rna_ImageUser_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
Scene *scene= CTX_data_scene(C);
ImageUser *iuser= ptr->data;
BKE_image_user_calc_imanr(iuser, scene->r.cfra, 0);

View File

@ -194,10 +194,10 @@ void rna_object_vgroup_name_set(struct PointerRNA *ptr, const char *value, char
void rna_object_uvlayer_name_set(struct PointerRNA *ptr, const char *value, char *result, int maxlen);
void rna_object_vcollayer_name_set(struct PointerRNA *ptr, const char *value, char *result, int maxlen);
void rna_Object_update(struct bContext *C, struct PointerRNA *ptr);
void rna_Object_update_data(struct bContext *C, struct PointerRNA *ptr);
void rna_Mesh_update_draw(struct bContext *C, struct PointerRNA *ptr);
void rna_TextureSlot_update(struct bContext *C, struct PointerRNA *ptr);
void rna_Object_update(struct Main *bmain, struct Scene *scene, struct PointerRNA *ptr);
void rna_Object_update_data(struct Main *bmain, struct Scene *scene, struct PointerRNA *ptr);
void rna_Mesh_update_draw(struct Main *bmain, struct Scene *scene, struct PointerRNA *ptr);
void rna_TextureSlot_update(struct Main *bmain, struct Scene *scene, struct PointerRNA *ptr);
char *rna_TextureSlot_path(struct PointerRNA *ptr);

View File

@ -38,6 +38,8 @@ struct CollectionPropertyIterator;
struct bContext;
struct IDProperty;
struct GHash;
struct Main;
struct Scene;
#ifdef UNIT_TEST
#define RNA_MAX_ARRAY_LENGTH 64
@ -53,7 +55,8 @@ struct GHash;
/* Function Callbacks */
typedef void (*UpdateFunc)(struct bContext *C, struct PointerRNA *ptr);
typedef void (*UpdateFunc)(struct Main *main, struct Scene *scene, struct PointerRNA *ptr);
typedef void (*ContextUpdateFunc)(struct bContext *C, struct PointerRNA *ptr);
typedef int (*EditableFunc)(struct PointerRNA *ptr);
typedef int (*ItemEditableFunc)(struct PointerRNA *ptr, int index);
typedef struct IDProperty* (*IDPropertiesFunc)(struct PointerRNA *ptr, int create);

View File

@ -286,16 +286,15 @@ static char *rna_ShapeKey_path(PointerRNA *ptr)
return BLI_sprintfN("keys[\"%s\"]", ((KeyBlock*)ptr->data)->name);
}
static void rna_Key_update_data(bContext *C, PointerRNA *ptr)
static void rna_Key_update_data(Main *bmain, Scene *scene, PointerRNA *ptr)
{
Main *bmain= CTX_data_main(C);
Key *key= ptr->id.data;
Object *ob;
for(ob=bmain->object.first; ob; ob= ob->id.next) {
if(ob_get_key(ob) == key) {
DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob);
WM_main_add_notifier(NC_OBJECT|ND_MODIFIER, ob);
}
}
}

View File

@ -100,28 +100,28 @@ static StructRNA* rna_Lamp_refine(struct PointerRNA *ptr)
}
}
static void rna_Lamp_update(bContext *C, PointerRNA *ptr)
static void rna_Lamp_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
Lamp *la= ptr->id.data;
DAG_id_flush_update(&la->id, 0);
WM_event_add_notifier(C, NC_LAMP|ND_LIGHTING, la);
WM_main_add_notifier(NC_LAMP|ND_LIGHTING, la);
}
static void rna_Lamp_draw_update(bContext *C, PointerRNA *ptr)
static void rna_Lamp_draw_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
Lamp *la= ptr->id.data;
DAG_id_flush_update(&la->id, 0);
WM_event_add_notifier(C, NC_LAMP|ND_LIGHTING_DRAW, la);
WM_main_add_notifier(NC_LAMP|ND_LIGHTING_DRAW, la);
}
static void rna_Lamp_sky_update(bContext *C, PointerRNA *ptr)
static void rna_Lamp_sky_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
Lamp *la= ptr->id.data;
DAG_id_flush_update(&la->id, 0);
WM_event_add_notifier(C, NC_LAMP|ND_SKY, la);
WM_main_add_notifier(NC_LAMP|ND_SKY, la);
}
#else

View File

@ -87,17 +87,16 @@ static void rna_Lattice_points_begin(CollectionPropertyIterator *iter, PointerRN
rna_iterator_array_begin(iter, NULL, 0, 0, 0, NULL);
}
static void rna_Lattice_update_data(bContext *C, PointerRNA *ptr)
static void rna_Lattice_update_data(Main *bmain, Scene *scene, PointerRNA *ptr)
{
ID *id= ptr->id.data;
DAG_id_flush_update(id, OB_RECALC_DATA);
WM_event_add_notifier(C, NC_GEOM|ND_DATA, id);
WM_main_add_notifier(NC_GEOM|ND_DATA, id);
}
static void rna_Lattice_update_size(bContext *C, PointerRNA *ptr)
static void rna_Lattice_update_size(Main *bmain, Scene *scene, PointerRNA *ptr)
{
Main *bmain= CTX_data_main(C);
Lattice *lt= ptr->id.data;
Object *ob;
int newu, newv, neww;
@ -124,7 +123,7 @@ static void rna_Lattice_update_size(bContext *C, PointerRNA *ptr)
resizelattice(lt->editlatt, newu, newv, neww, NULL);
}
rna_Lattice_update_data(C, ptr);
rna_Lattice_update_data(bmain, scene, ptr);
}
static void rna_Lattice_outside_set(PointerRNA *ptr, int value)

View File

@ -50,41 +50,41 @@
#include "DNA_mesh_types.h"
#include "DNA_object_types.h"
static Mesh *rna_Main_add_mesh(Main *main, char *name)
static Mesh *rna_Main_add_mesh(Main *bmain, char *name)
{
Mesh *me= add_mesh(name);
me->id.us--;
return me;
}
static void rna_Main_remove_mesh(Main *main, ReportList *reports, Mesh *me)
static void rna_Main_remove_mesh(Main *bmain, ReportList *reports, Mesh *me)
{
if(me->id.us == 0)
free_libblock(&main->mesh, me);
free_libblock(&bmain->mesh, me);
else
BKE_report(reports, RPT_ERROR, "Mesh must have zero users to be removed.");
/* XXX python now has invalid pointer? */
}
static void rna_Main_remove_armature(Main *main, ReportList *reports, bArmature *arm)
static void rna_Main_remove_armature(Main *bmain, ReportList *reports, bArmature *arm)
{
if(arm->id.us == 0)
free_libblock(&main->armature, arm);
free_libblock(&bmain->armature, arm);
else
BKE_report(reports, RPT_ERROR, "Armature must have zero users to be removed.");
/* XXX python now has invalid pointer? */
}
static bArmature *rna_Main_add_armature(Main *main, char *name)
static bArmature *rna_Main_add_armature(Main *bmain, char *name)
{
bArmature *arm= add_armature(name);
arm->id.us--;
return arm;
}
static Lamp *rna_Main_add_lamp(Main *main, char *name)
static Lamp *rna_Main_add_lamp(Main *bmain, char *name)
{
Lamp *la= add_lamp(name);
la->id.us--;
@ -92,7 +92,7 @@ static Lamp *rna_Main_add_lamp(Main *main, char *name)
}
/*
static void rna_Main_remove_lamp(Main *main, ReportList *reports, Lamp *la)
static void rna_Main_remove_lamp(Main *bmain, ReportList *reports, Lamp *la)
{
if(la->id.us == 0)
free_libblock(&main->lamp, la);
@ -101,7 +101,7 @@ static void rna_Main_remove_lamp(Main *main, ReportList *reports, Lamp *la)
}
*/
static Object* rna_Main_add_object(Main *main, int type, char *name)
static Object* rna_Main_add_object(Main *bmain, int type, char *name)
{
Object *ob= add_only_object(type, name);
ob->id.us--;
@ -120,29 +120,29 @@ static Object* rna_Main_add_object(Main *main, int type, char *name)
# don't do this since ob is already freed!
bpy.data.remove_object(ob)
*/
static void rna_Main_remove_object(Main *main, ReportList *reports, Object *ob)
static void rna_Main_remove_object(Main *bmain, ReportList *reports, Object *ob)
{
if(ob->id.us == 0)
free_libblock(&main->object, ob);
free_libblock(&bmain->object, ob);
else
BKE_report(reports, RPT_ERROR, "Object must have zero users to be removed.");
}
static Material *rna_Main_add_material(Main *main, char *name)
static Material *rna_Main_add_material(Main *bmain, char *name)
{
return add_material(name);
}
/* TODO: remove material? */
struct Tex *rna_Main_add_texture(Main *main, char *name)
struct Tex *rna_Main_add_texture(Main *bmain, char *name)
{
return add_texture(name);
}
/* TODO: remove texture? */
struct Image *rna_Main_add_image(Main *main, char *filename)
struct Image *rna_Main_add_image(Main *bmain, char *filename)
{
return BKE_add_image_file(filename, 0);
}

View File

@ -64,20 +64,20 @@ static EnumPropertyItem prop_texture_coordinates_items[] = {
#include "ED_node.h"
static void rna_Material_update(bContext *C, PointerRNA *ptr)
static void rna_Material_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
Material *ma= ptr->id.data;
DAG_id_flush_update(&ma->id, 0);
WM_event_add_notifier(C, NC_MATERIAL|ND_SHADING, ma);
WM_main_add_notifier(NC_MATERIAL|ND_SHADING, ma);
}
static void rna_Material_draw_update(bContext *C, PointerRNA *ptr)
static void rna_Material_draw_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
Material *ma= ptr->id.data;
DAG_id_flush_update(&ma->id, 0);
WM_event_add_notifier(C, NC_MATERIAL|ND_SHADING_DRAW, ma);
WM_main_add_notifier(NC_MATERIAL|ND_SHADING_DRAW, ma);
}
static PointerRNA rna_Material_mirror_get(PointerRNA *ptr)

View File

@ -50,26 +50,26 @@
#include "WM_api.h"
#include "WM_types.h"
static void rna_Mesh_update_data(bContext *C, PointerRNA *ptr)
static void rna_Mesh_update_data(Main *bmain, Scene *scene, PointerRNA *ptr)
{
ID *id= ptr->id.data;
DAG_id_flush_update(id, OB_RECALC_DATA);
WM_event_add_notifier(C, NC_GEOM|ND_DATA, id);
WM_main_add_notifier(NC_GEOM|ND_DATA, id);
}
static void rna_Mesh_update_select(bContext *C, PointerRNA *ptr)
static void rna_Mesh_update_select(Main *bmain, Scene *scene, PointerRNA *ptr)
{
ID *id= ptr->id.data;
WM_event_add_notifier(C, NC_GEOM|ND_SELECT, id);
WM_main_add_notifier(NC_GEOM|ND_SELECT, id);
}
void rna_Mesh_update_draw(bContext *C, PointerRNA *ptr)
void rna_Mesh_update_draw(Main *bmain, Scene *scene, PointerRNA *ptr)
{
ID *id= ptr->id.data;
WM_event_add_notifier(C, NC_GEOM|ND_DATA, id);
WM_main_add_notifier(NC_GEOM|ND_DATA, id);
}
static void rna_MeshVertex_normal_get(PointerRNA *ptr, float *value)

View File

@ -50,10 +50,8 @@ static int rna_Meta_texspace_editable(PointerRNA *ptr)
return (mb->texflag & AUTOSPACE)? 0: PROP_EDITABLE;
}
static void rna_MetaBall_update_data(bContext *C, PointerRNA *ptr)
static void rna_MetaBall_update_data(Main *bmain, Scene *scene, PointerRNA *ptr)
{
Main *bmain= CTX_data_main(C);
Scene *scene= CTX_data_scene(C);
MetaBall *mb= ptr->id.data;
Object *ob;
@ -62,11 +60,9 @@ static void rna_MetaBall_update_data(bContext *C, PointerRNA *ptr)
copy_mball_properties(scene, ob);
DAG_id_flush_update(&mb->id, OB_RECALC_DATA);
WM_event_add_notifier(C, NC_GEOM|ND_DATA, mb);
WM_main_add_notifier(NC_GEOM|ND_DATA, mb);
}
#else
static void rna_def_metaelement(BlenderRNA *brna)

View File

@ -193,19 +193,19 @@ static char *rna_Modifier_path(PointerRNA *ptr)
return BLI_sprintfN("modifiers[\"%s\"]", ((ModifierData*)ptr->data)->name);
}
static void rna_Modifier_update(bContext *C, PointerRNA *ptr)
static void rna_Modifier_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
DAG_id_flush_update(ptr->id.data, OB_RECALC_DATA);
WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ptr->id.data);
WM_main_add_notifier(NC_OBJECT|ND_MODIFIER, ptr->id.data);
}
static void rna_Modifier_dependency_update(bContext *C, PointerRNA *ptr)
static void rna_Modifier_dependency_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
rna_Modifier_update(C, ptr);
DAG_scene_sort(CTX_data_scene(C));
rna_Modifier_update(bmain, scene, ptr);
DAG_scene_sort(scene);
}
static void rna_Smoke_set_type(bContext *C, PointerRNA *ptr)
static void rna_Smoke_set_type(Main *bmain, Scene *scene, PointerRNA *ptr)
{
SmokeModifierData *smd= (SmokeModifierData *)ptr->data;
Object *ob= (Object*)ptr->id.data;
@ -230,7 +230,7 @@ static void rna_Smoke_set_type(bContext *C, PointerRNA *ptr)
}
// update dependancy since a domain - other type switch could have happened
rna_Modifier_dependency_update(C, ptr);
rna_Modifier_dependency_update(bmain, scene, ptr);
}
static void rna_ExplodeModifier_vgroup_get(PointerRNA *ptr, char *value)

View File

@ -149,9 +149,8 @@ static void rna_Matte_t2_set(PointerRNA *ptr, float value)
chroma->t2 = value;
}
static void node_update(bContext *C, bNodeTree *ntree, bNode *node)
static void node_update(Main *bmain, Scene *scene, bNodeTree *ntree, bNode *node)
{
Main *bmain= CTX_data_main(C);
Material *ma;
Tex *tex;
Scene *sce;
@ -170,15 +169,15 @@ static void node_update(bContext *C, bNodeTree *ntree, bNode *node)
ED_node_changed_update(&sce->id, node);
}
static void rna_Node_update(bContext *C, PointerRNA *ptr)
static void rna_Node_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
bNodeTree *ntree= (bNodeTree*)ptr->id.data;
bNode *node= (bNode*)ptr->data;
node_update(C, ntree, node);
node_update(bmain, scene, ntree, node);
}
static void rna_Node_update_name(bContext *C, PointerRNA *ptr)
static void rna_Node_update_name(Main *bmain, Scene *scene, PointerRNA *ptr)
{
bNodeTree *ntree= (bNodeTree*)ptr->id.data;
bNode *node= (bNode*)ptr->data;
@ -193,12 +192,12 @@ static void rna_Node_update_name(bContext *C, PointerRNA *ptr)
/* fix all the animation data which may link to this */
BKE_all_animdata_fix_paths_rename("nodes", oldname, node->name);
node_update(C, ntree, node);
node_update(bmain, scene, ntree, node);
}
/* this should be done at display time! if no custom names are set */
#if 0
static void rna_Node_update_username(bContext *C, PointerRNA *ptr)
static void rna_Node_update_username(Main *bmain, Scene *scene, PointerRNA *ptr)
{
bNode *node= (bNode*)ptr->data;
const char *name;
@ -241,18 +240,18 @@ static void rna_Node_update_username(bContext *C, PointerRNA *ptr)
}
}
rna_Node_update(C, ptr);
rna_Node_update(bmain, scene, ptr);
}
#endif
static void rna_NodeSocket_update(bContext *C, PointerRNA *ptr)
static void rna_NodeSocket_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
bNodeTree *ntree= (bNodeTree*)ptr->id.data;
bNodeSocket *sock= (bNodeSocket*)ptr->data;
bNode *node;
if (nodeFindNode(ntree, sock, &node, NULL))
node_update(C, ntree, node);
node_update(bmain, scene, ntree, node);
}
static void rna_NodeSocket_defvalue_range(PointerRNA *ptr, float *min, float *max)
@ -263,16 +262,16 @@ static void rna_NodeSocket_defvalue_range(PointerRNA *ptr, float *min, float *ma
*max = sock->ns.max;
}
static void rna_Node_mapping_update(bContext *C, PointerRNA *ptr)
static void rna_Node_mapping_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
bNode *node= (bNode*)ptr->data;
init_mapping((TexMapping *)node->storage);
rna_Node_update(C, ptr);
rna_Node_update(bmain, scene, ptr);
}
static void rna_Node_image_layer_update(bContext *C, PointerRNA *ptr)
static void rna_Node_image_layer_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
bNode *node= (bNode*)ptr->data;
Image *ima = (Image *)node->id;
@ -281,7 +280,7 @@ static void rna_Node_image_layer_update(bContext *C, PointerRNA *ptr)
BKE_image_multilayer_index(ima->rr, iuser);
BKE_image_signal(ima, iuser, IMA_SIGNAL_SRC_CHANGE);
rna_Node_update(C, ptr);
rna_Node_update(bmain, scene, ptr);
}
static EnumPropertyItem *renderresult_layers_add_enum(RenderLayer *rl)

View File

@ -114,56 +114,56 @@ EnumPropertyItem object_type_items[] = {
#include "BLI_editVert.h" /* for EditMesh->mat_nr */
#include "ED_mesh.h"
#include "ED_object.h"
#include "ED_particle.h"
void rna_Object_update(bContext *C, PointerRNA *ptr)
void rna_Object_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
DAG_id_flush_update(ptr->id.data, OB_RECALC_OB);
}
void rna_Object_matrix_update(bContext *C, PointerRNA *ptr)
void rna_Object_matrix_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
ED_object_apply_obmat(ptr->id.data);
rna_Object_update(C, ptr);
rna_Object_update(bmain, scene, ptr);
}
void rna_Object_update_data(bContext *C, PointerRNA *ptr)
void rna_Object_update_data(Main *bmain, Scene *scene, PointerRNA *ptr)
{
DAG_id_flush_update(ptr->id.data, OB_RECALC_DATA);
WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ptr->id.data);
WM_main_add_notifier(NC_OBJECT|ND_DRAW, ptr->id.data);
}
void rna_Object_active_shape_update(bContext *C, PointerRNA *ptr)
void rna_Object_active_shape_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
Object *ob= ptr->id.data;
Scene *scene= CTX_data_scene(C);
int editmode= (scene->obedit == ob && ob->type == OB_MESH);
if(editmode) {
/* exit/enter editmode to get new shape */
ED_object_exit_editmode(C, EM_FREEDATA|EM_FREEUNDO);
ED_object_enter_editmode(C, EM_WAITCURSOR);
load_editMesh(scene, ob);
make_editMesh(scene, ob);
}
rna_Object_update_data(C, ptr);
rna_Object_update_data(bmain, scene, ptr);
}
static void rna_Object_dependency_update(bContext *C, PointerRNA *ptr)
static void rna_Object_dependency_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
DAG_id_flush_update(ptr->id.data, OB_RECALC_OB);
DAG_scene_sort(CTX_data_scene(C));
DAG_scene_sort(scene);
}
/* when changing the selection flag the scene needs updating */
static void rna_Object_select_update(bContext *C, PointerRNA *ptr)
static void rna_Object_select_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
Object *ob= (Object*)ptr->id.data;
short mode = ob->flag & SELECT ? BA_SELECT : BA_DESELECT;
ED_base_object_select(object_in_scene(ob, CTX_data_scene(C)), mode);
ED_base_object_select(object_in_scene(ob, scene), mode);
}
static void rna_Base_select_update(bContext *C, PointerRNA *ptr)
static void rna_Base_select_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
Base *base= (Base*)ptr->data;
short mode = base->flag & BA_SELECT ? BA_SELECT : BA_DESELECT;
@ -182,10 +182,9 @@ static void rna_Object_layer_update__internal(Scene *scene, Base *base, Object *
}
}
static void rna_Object_layer_update(bContext *C, PointerRNA *ptr)
static void rna_Object_layer_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
Object *ob= (Object*)ptr->id.data;
Scene *scene= CTX_data_scene(C);
Base *base;
base= object_in_scene(ob, scene);
@ -196,11 +195,10 @@ static void rna_Object_layer_update(bContext *C, PointerRNA *ptr)
rna_Object_layer_update__internal(scene, base, ob);
}
static void rna_Base_layer_update(bContext *C, PointerRNA *ptr)
static void rna_Base_layer_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
Base *base= (Base*)ptr->id.data;
Object *ob= (Object*)base->object;
Scene *scene= CTX_data_scene(C);
ob->lay= base->lay;
@ -527,9 +525,8 @@ static void rna_Object_active_particle_system_index_set(PointerRNA *ptr, int val
psys_set_current_num(ob, value);
}
static void rna_Object_particle_update(bContext *C, PointerRNA *ptr)
static void rna_Object_particle_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
Scene *scene= CTX_data_scene(C);
Object *ob= (Object*)ptr->id.data;
PE_current_changed(scene, ob);
@ -972,7 +969,7 @@ static void rna_Object_active_constraint_set(PointerRNA *ptr, PointerRNA value)
static bConstraint *rna_Object_constraint_new(Object *object, bContext *C, int type)
{
WM_event_add_notifier(C, NC_OBJECT|ND_CONSTRAINT|NA_ADDED, object);
WM_main_add_notifier(NC_OBJECT|ND_CONSTRAINT|NA_ADDED, object);
return add_ob_constraint(object, NULL, type);
}
@ -981,7 +978,7 @@ static int rna_Object_constraint_remove(Object *object, bContext *C, int index)
int ok = remove_constraint_index(&object->constraints, index);
if(ok) {
ED_object_constraint_set_active(object, NULL);
WM_event_add_notifier(C, NC_OBJECT|ND_CONSTRAINT, object);
WM_main_add_notifier(NC_OBJECT|ND_CONSTRAINT, object);
}
return ok;

View File

@ -97,9 +97,9 @@ EnumPropertyItem empty_vortex_shape_items[] = {
#include "ED_object.h"
static void rna_Cache_change(bContext *C, PointerRNA *ptr)
static void rna_Cache_change(Main *bmain, Scene *scene, PointerRNA *ptr)
{
Object *ob = CTX_data_active_object(C);
Object *ob = (Object*)ptr->id.data;
PointCache *cache = (PointCache*)ptr->data;
PTCacheID *pid = NULL;
ListBase pidlist;
@ -124,9 +124,9 @@ static void rna_Cache_change(bContext *C, PointerRNA *ptr)
BLI_freelistN(&pidlist);
}
static void rna_Cache_toggle_disk_cache(bContext *C, PointerRNA *ptr)
static void rna_Cache_toggle_disk_cache(Main *bmain, Scene *scene, PointerRNA *ptr)
{
Object *ob = CTX_data_active_object(C);
Object *ob = (Object*)ptr->id.data;
PointCache *cache = (PointCache*)ptr->data;
PTCacheID *pid = NULL;
ListBase pidlist;
@ -147,9 +147,9 @@ static void rna_Cache_toggle_disk_cache(bContext *C, PointerRNA *ptr)
BLI_freelistN(&pidlist);
}
static void rna_Cache_idname_change(bContext *C, PointerRNA *ptr)
static void rna_Cache_idname_change(Main *bmain, Scene *scene, PointerRNA *ptr)
{
Object *ob = CTX_data_active_object(C);
Object *ob = (Object*)ptr->id.data;
PointCache *cache = (PointCache*)ptr->data;
PTCacheID *pid = NULL, *pid2= NULL;
ListBase pidlist;
@ -440,7 +440,7 @@ static int particle_id_check(PointerRNA *ptr)
return (GS(id->name) == ID_PA);
}
static void rna_FieldSettings_update(bContext *C, PointerRNA *ptr)
static void rna_FieldSettings_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
if(particle_id_check(ptr)) {
ParticleSettings *part = (ParticleSettings*)ptr->id.data;
@ -456,7 +456,7 @@ static void rna_FieldSettings_update(bContext *C, PointerRNA *ptr)
}
DAG_id_flush_update(&part->id, OB_RECALC|PSYS_RECALC_RESET);
WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, NULL);
WM_main_add_notifier(NC_OBJECT|ND_DRAW, NULL);
}
else {
@ -468,14 +468,12 @@ static void rna_FieldSettings_update(bContext *C, PointerRNA *ptr)
}
DAG_id_flush_update(&ob->id, OB_RECALC_OB);
WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
WM_main_add_notifier(NC_OBJECT|ND_DRAW, ob);
}
}
static void rna_FieldSettings_shape_update(bContext *C, PointerRNA *ptr)
static void rna_FieldSettings_shape_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
Scene *scene= CTX_data_scene(C);
if(!particle_id_check(ptr)) {
Object *ob= (Object*)ptr->id.data;
PartDeflect *pd= ob->pd;
@ -492,14 +490,12 @@ static void rna_FieldSettings_shape_update(bContext *C, PointerRNA *ptr)
ED_object_modifier_remove(NULL, scene, ob, md);
}
WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
WM_main_add_notifier(NC_OBJECT|ND_DRAW, ob);
}
}
static void rna_FieldSettings_dependency_update(bContext *C, PointerRNA *ptr)
static void rna_FieldSettings_dependency_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
Scene *scene= CTX_data_scene(C);
if(particle_id_check(ptr)) {
DAG_id_flush_update((ID*)ptr->id.data, OB_RECALC|PSYS_RECALC_RESET);
}
@ -513,7 +509,7 @@ static void rna_FieldSettings_dependency_update(bContext *C, PointerRNA *ptr)
do_curvebuts(B_CU3D); // all curves too
}*/
rna_FieldSettings_shape_update(C, ptr);
rna_FieldSettings_shape_update(bmain, scene, ptr);
DAG_scene_sort(scene);
@ -522,7 +518,7 @@ static void rna_FieldSettings_dependency_update(bContext *C, PointerRNA *ptr)
else
DAG_id_flush_update(&ob->id, OB_RECALC_OB);
WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
WM_main_add_notifier(NC_OBJECT|ND_DRAW, ob);
}
}
@ -550,22 +546,20 @@ static char *rna_FieldSettings_path(PointerRNA *ptr)
return NULL;
}
static void rna_EffectorWeight_update(bContext *C, PointerRNA *ptr)
static void rna_EffectorWeight_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
DAG_id_flush_update((ID*)ptr->id.data, OB_RECALC_DATA|PSYS_RECALC_RESET);
WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, NULL);
WM_main_add_notifier(NC_OBJECT|ND_DRAW, NULL);
}
static void rna_EffectorWeight_dependency_update(bContext *C, PointerRNA *ptr)
static void rna_EffectorWeight_dependency_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
Scene *scene= CTX_data_scene(C);
DAG_scene_sort(scene);
DAG_id_flush_update((ID*)ptr->id.data, OB_RECALC_DATA|PSYS_RECALC_RESET);
WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, NULL);
WM_main_add_notifier(NC_OBJECT|ND_DRAW, NULL);
}
static char *rna_EffectorWeight_path(PointerRNA *ptr)
@ -612,9 +606,8 @@ static char *rna_EffectorWeight_path(PointerRNA *ptr)
return NULL;
}
static void rna_CollisionSettings_dependency_update(bContext *C, PointerRNA *ptr)
static void rna_CollisionSettings_dependency_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
Scene *scene= CTX_data_scene(C);
Object *ob= (Object*)ptr->id.data;
ModifierData *md= modifiers_findByType(ob, eModifierType_Collision);
@ -624,23 +617,23 @@ static void rna_CollisionSettings_dependency_update(bContext *C, PointerRNA *ptr
else if(!ob->pd->deflect && md)
ED_object_modifier_remove(NULL, scene, ob, md);
WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
WM_main_add_notifier(NC_OBJECT|ND_DRAW, ob);
}
static void rna_CollisionSettings_update(bContext *C, PointerRNA *ptr)
static void rna_CollisionSettings_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
Object *ob= (Object*)ptr->id.data;
DAG_id_flush_update(&ob->id, OB_RECALC);
WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
WM_main_add_notifier(NC_OBJECT|ND_DRAW, ob);
}
static void rna_softbody_update(bContext *C, PointerRNA *ptr)
static void rna_softbody_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
Object *ob= (Object*)ptr->id.data;
DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob);
WM_main_add_notifier(NC_OBJECT|ND_MODIFIER, ob);
}

Some files were not shown because too many files have changed in this diff Show More