Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
blender-addons
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
blender
blender-addons
Commits
4330632e
Commit
4330632e
authored
13 years ago
by
Campbell Barton
Browse files
Options
Downloads
Patches
Plain Diff
Superficial pep8 edits
parent
2bb8bb9b
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
mocap/__init__.py
+6
-10
6 additions, 10 deletions
mocap/__init__.py
mocap/mocap_constraints.py
+1
-1
1 addition, 1 deletion
mocap/mocap_constraints.py
mocap/mocap_tools.py
+5
-4
5 additions, 4 deletions
mocap/mocap_tools.py
with
12 additions
and
15 deletions
mocap/__init__.py
+
6
−
10
View file @
4330632e
...
@@ -26,7 +26,7 @@ bl_info = {
...
@@ -26,7 +26,7 @@ bl_info = {
"
location
"
:
"
Object UI -> Mocap tools
"
,
"
location
"
:
"
Object UI -> Mocap tools
"
,
"
description
"
:
"
Various tools for working with motion capture animation
"
,
"
description
"
:
"
Various tools for working with motion capture animation
"
,
"
warning
"
:
""
,
"
warning
"
:
""
,
"
wiki_url
"
:
(
"
http://wiki.blender.org/index.php/User:Benjycook/GSOC/Manual
"
)
,
"
wiki_url
"
:
"
http://wiki.blender.org/index.php/User:Benjycook/GSOC/Manual
"
,
"
tracker_url
"
:
""
,
"
tracker_url
"
:
""
,
"
support
"
:
'
OFFICIAL
'
,
"
support
"
:
'
OFFICIAL
'
,
"
category
"
:
"
Animation
"
}
"
category
"
:
"
Animation
"
}
...
@@ -121,7 +121,6 @@ class MocapConstraint(bpy.types.PropertyGroup):
...
@@ -121,7 +121,6 @@ class MocapConstraint(bpy.types.PropertyGroup):
real_constraint_bone
=
bpy
.
props
.
StringProperty
()
real_constraint_bone
=
bpy
.
props
.
StringProperty
()
# Animation Stitch Settings, used for animation stitching of 2 retargeted animations.
# Animation Stitch Settings, used for animation stitching of 2 retargeted animations.
class
AnimationStitchSettings
(
bpy
.
types
.
PropertyGroup
):
class
AnimationStitchSettings
(
bpy
.
types
.
PropertyGroup
):
first_action
=
bpy
.
props
.
StringProperty
(
name
=
"
Action 1
"
,
first_action
=
bpy
.
props
.
StringProperty
(
name
=
"
Action 1
"
,
...
@@ -141,7 +140,6 @@ class AnimationStitchSettings(bpy.types.PropertyGroup):
...
@@ -141,7 +140,6 @@ class AnimationStitchSettings(bpy.types.PropertyGroup):
default
=
""
)
default
=
""
)
# MocapNLA Tracks. Stores which tracks/actions are associated with each retargeted animation.
# MocapNLA Tracks. Stores which tracks/actions are associated with each retargeted animation.
class
MocapNLATracks
(
bpy
.
types
.
PropertyGroup
):
class
MocapNLATracks
(
bpy
.
types
.
PropertyGroup
):
name
=
bpy
.
props
.
StringProperty
()
name
=
bpy
.
props
.
StringProperty
()
...
@@ -151,8 +149,6 @@ class MocapNLATracks(bpy.types.PropertyGroup):
...
@@ -151,8 +149,6 @@ class MocapNLATracks(bpy.types.PropertyGroup):
stride_action
=
bpy
.
props
.
StringProperty
()
stride_action
=
bpy
.
props
.
StringProperty
()
#Update function for Advanced Retarget boolean variable.
#Update function for Advanced Retarget boolean variable.
def
advancedRetargetToggle
(
self
,
context
):
def
advancedRetargetToggle
(
self
,
context
):
enduser_obj
=
context
.
active_object
enduser_obj
=
context
.
active_object
...
@@ -168,7 +164,6 @@ def advancedRetargetToggle(self, context):
...
@@ -168,7 +164,6 @@ def advancedRetargetToggle(self, context):
retarget
.
cleanTempConstraints
(
enduser_obj
)
retarget
.
cleanTempConstraints
(
enduser_obj
)
def
toggleIKBone
(
self
,
context
):
def
toggleIKBone
(
self
,
context
):
#Update function for IK functionality. Is called when IK prop checkboxes are toggled.
#Update function for IK functionality. Is called when IK prop checkboxes are toggled.
if
self
.
IKRetarget
:
if
self
.
IKRetarget
:
...
@@ -220,7 +215,6 @@ class MocapMapping(bpy.types.PropertyGroup):
...
@@ -220,7 +215,6 @@ class MocapMapping(bpy.types.PropertyGroup):
name
=
bpy
.
props
.
StringProperty
()
name
=
bpy
.
props
.
StringProperty
()
def
updateIKRetarget
():
def
updateIKRetarget
():
# ensures that Blender constraints and IK properties are in sync
# ensures that Blender constraints and IK properties are in sync
# currently runs when module is loaded, should run when scene is loaded
# currently runs when module is loaded, should run when scene is loaded
...
@@ -237,6 +231,7 @@ def updateIKRetarget():
...
@@ -237,6 +231,7 @@ def updateIKRetarget():
updateIKRetarget
()
updateIKRetarget
()
def
hasIKConstraint
(
pose_bone
):
def
hasIKConstraint
(
pose_bone
):
#utility function / predicate, returns True if given bone has IK constraint
#utility function / predicate, returns True if given bone has IK constraint
ik
=
[
constraint
for
constraint
in
pose_bone
.
constraints
if
constraint
.
type
==
"
IK
"
]
ik
=
[
constraint
for
constraint
in
pose_bone
.
constraints
if
constraint
.
type
==
"
IK
"
]
...
@@ -245,6 +240,7 @@ def hasIKConstraint(pose_bone):
...
@@ -245,6 +240,7 @@ def hasIKConstraint(pose_bone):
else
:
else
:
return
False
return
False
class
MocapPanel
(
bpy
.
types
.
Panel
):
class
MocapPanel
(
bpy
.
types
.
Panel
):
# Motion capture retargeting panel
# Motion capture retargeting panel
bl_label
=
"
Mocap tools
"
bl_label
=
"
Mocap tools
"
...
@@ -281,7 +277,7 @@ class MocapPanel(bpy.types.Panel):
...
@@ -281,7 +277,7 @@ class MocapPanel(bpy.types.Panel):
perf_pose_bones
=
enduser_obj
.
pose
.
bones
perf_pose_bones
=
enduser_obj
.
pose
.
bones
MappingRow
=
self
.
layout
.
row
(
align
=
True
)
MappingRow
=
self
.
layout
.
row
(
align
=
True
)
footCol
=
MappingRow
.
column
(
align
=
True
)
footCol
=
MappingRow
.
column
(
align
=
True
)
nameCol
=
MappingRow
.
column
(
align
=
True
)
nameCol
=
MappingRow
.
column
(
align
=
True
)
nameCol
.
scale_x
=
2
nameCol
.
scale_x
=
2
mapCol
=
MappingRow
.
column
(
align
=
True
)
mapCol
=
MappingRow
.
column
(
align
=
True
)
mapCol
.
scale_x
=
2
mapCol
.
scale_x
=
2
...
@@ -877,8 +873,8 @@ def register():
...
@@ -877,8 +873,8 @@ def register():
description
=
"
Amount of frames to skip - for previewing retargets quickly. 1 is fully sampled
"
,
description
=
"
Amount of frames to skip - for previewing retargets quickly. 1 is fully sampled
"
,
min
=
1
)
min
=
1
)
bpy
.
utils
.
register_module
(
__name__
)
bpy
.
utils
.
register_module
(
__name__
)
def
unregister
():
def
unregister
():
bpy
.
utils
.
unregister_module
(
__name__
)
bpy
.
utils
.
unregister_module
(
__name__
)
...
...
This diff is collapsed.
Click to expand it.
mocap/mocap_constraints.py
+
1
−
1
View file @
4330632e
...
@@ -282,7 +282,7 @@ def setConstraint(m_constraint, context):
...
@@ -282,7 +282,7 @@ def setConstraint(m_constraint, context):
real_constraint
.
target
=
obj
real_constraint
.
target
=
obj
real_constraint
.
subtarget
=
getConsObj
(
bones
[
m_constraint
.
constrained_boneB
]).
name
real_constraint
.
subtarget
=
getConsObj
(
bones
[
m_constraint
.
constrained_boneB
]).
name
real_constraint
.
limit_mode
=
"
LIMITDIST_ONSURFACE
"
real_constraint
.
limit_mode
=
"
LIMITDIST_ONSURFACE
"
if
m_constraint
.
targetDist
<
0.01
:
if
m_constraint
.
targetDist
<
0.01
:
m_constraint
.
targetDist
=
0.01
m_constraint
.
targetDist
=
0.01
real_constraint
.
distance
=
m_constraint
.
targetDist
real_constraint
.
distance
=
m_constraint
.
targetDist
...
...
This diff is collapsed.
Click to expand it.
mocap/mocap_tools.py
+
5
−
4
View file @
4330632e
...
@@ -116,8 +116,8 @@ class dataPoint:
...
@@ -116,8 +116,8 @@ class dataPoint:
def
crossCorrelationMatch
(
curvesA
,
curvesB
,
margin
):
def
crossCorrelationMatch
(
curvesA
,
curvesB
,
margin
):
dataA
=
[]
dataA
=
[]
dataB
=
[]
dataB
=
[]
start
=
int
(
max
(
curvesA
[
0
].
range
()[
0
],
curvesB
[
0
].
range
()[
0
]))
start
=
int
(
max
(
curvesA
[
0
].
range
()[
0
],
curvesB
[
0
].
range
()[
0
]))
end
=
int
(
min
(
curvesA
[
0
].
range
()[
1
],
curvesB
[
0
].
range
()[
1
]))
end
=
int
(
min
(
curvesA
[
0
].
range
()[
1
],
curvesB
[
0
].
range
()[
1
]))
#transfer all fcurves data on each frame to a single NdVector.
#transfer all fcurves data on each frame to a single NdVector.
for
i
in
range
(
1
,
end
):
for
i
in
range
(
1
,
end
):
...
@@ -131,6 +131,7 @@ def crossCorrelationMatch(curvesA, curvesB, margin):
...
@@ -131,6 +131,7 @@ def crossCorrelationMatch(curvesA, curvesB, margin):
if
fcurve
.
data_path
in
[
otherFcurve
.
data_path
for
otherFcurve
in
curvesA
]:
if
fcurve
.
data_path
in
[
otherFcurve
.
data_path
for
otherFcurve
in
curvesA
]:
vec
.
append
(
fcurve
.
evaluate
(
i
))
vec
.
append
(
fcurve
.
evaluate
(
i
))
dataB
.
append
(
NdVector
(
vec
))
dataB
.
append
(
NdVector
(
vec
))
#Comparator for Cross Correlation. "Classic" implementation uses dot product, as do we.
#Comparator for Cross Correlation. "Classic" implementation uses dot product, as do we.
def
comp
(
a
,
b
):
def
comp
(
a
,
b
):
return
a
*
b
return
a
*
b
...
@@ -877,7 +878,7 @@ def anim_stitch(context, enduser_obj):
...
@@ -877,7 +878,7 @@ def anim_stitch(context, enduser_obj):
scene
.
frame_set
(
stitch_settings
.
blend_frame
-
1
)
scene
.
frame_set
(
stitch_settings
.
blend_frame
-
1
)
desired_pos
=
(
enduser_obj
.
matrix_world
*
selected_bone
.
matrix
.
to_translation
())
desired_pos
=
(
enduser_obj
.
matrix_world
*
selected_bone
.
matrix
.
to_translation
())
scene
.
frame_set
(
stitch_settings
.
blend_frame
)
scene
.
frame_set
(
stitch_settings
.
blend_frame
)
actual_pos
=
(
enduser_obj
.
matrix_world
*
selected_bone
.
matrix
.
to_translation
()
)
actual_pos
=
(
enduser_obj
.
matrix_world
*
selected_bone
.
matrix
.
to_translation
())
print
(
desired_pos
,
actual_pos
)
print
(
desired_pos
,
actual_pos
)
offset
=
Vector
(
actual_pos
)
-
Vector
(
desired_pos
)
offset
=
Vector
(
actual_pos
)
-
Vector
(
desired_pos
)
...
@@ -887,7 +888,7 @@ def anim_stitch(context, enduser_obj):
...
@@ -887,7 +888,7 @@ def anim_stitch(context, enduser_obj):
pt
.
co
.
y
-=
offset
[
i
]
pt
.
co
.
y
-=
offset
[
i
]
pt
.
handle_left
.
y
-=
offset
[
i
]
pt
.
handle_left
.
y
-=
offset
[
i
]
pt
.
handle_right
.
y
-=
offset
[
i
]
pt
.
handle_right
.
y
-=
offset
[
i
]
#actionBStrip.blend_in = stitch_settings.blend_amount
#actionBStrip.blend_in = stitch_settings.blend_amount
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment