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
db0e8f44
Commit
db0e8f44
authored
14 years ago
by
John Phan
Browse files
Options
Downloads
Patches
Plain Diff
Added rebuild armature button bones from scrape selected armature.
parent
9c208086
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
io_export_unreal_psk_psa.py
+92
-1
92 additions, 1 deletion
io_export_unreal_psk_psa.py
with
92 additions
and
1 deletion
io_export_unreal_psk_psa.py
+
92
−
1
View file @
db0e8f44
...
...
@@ -1923,6 +1923,7 @@ class VIEW3D_PT_unrealtools_objectmode(bpy.types.Panel):
layout
.
label
(
text
=
"
Match Found:
"
+
str
(
actionsetmatchcount
))
layout
.
operator
(
OBJECT_OT_UTSelectedFaceSmooth
.
bl_idname
)
layout
.
operator
(
OBJECT_OT_UTRebuildArmature
.
bl_idname
)
#row = layout.row()
#row.label(text="Action Set(s)(not build)")
#for action in bpy.data.actions:
...
...
@@ -1999,7 +2000,97 @@ class OBJECT_OT_UTSelectedFaceSmooth(bpy.types.Operator):
#objects = bpy.data.objects
return
{
'
FINISHED
'
}
class
OBJECT_OT_UTRebuildArmature
(
bpy
.
types
.
Operator
):
bl_idname
=
"
object.utrebuildarmature
"
# XXX, name???
bl_label
=
"
Rebuild Armature
"
__doc__
=
"
Roll bone rotation not working yet. It rebuild the select armature object scrape to raw setup build.
"
def
invoke
(
self
,
context
,
event
):
#print("Init Export Script:")
for
obj
in
bpy
.
data
.
objects
:
#print(dir(obj))
if
obj
.
type
==
'
ARMATURE
'
and
obj
.
select
==
True
:
print
(
"
Armature Name:
"
,
obj
.
name
)
#print(dir(obj.data))
objectname
=
"
armaturedata
"
meshname
=
"
ArmatureObject
"
armdata
=
bpy
.
data
.
armatures
.
new
(
objectname
)
ob_new
=
bpy
.
data
.
objects
.
new
(
meshname
,
armdata
)
bpy
.
context
.
scene
.
objects
.
link
(
ob_new
)
for
i
in
bpy
.
context
.
scene
.
objects
:
i
.
select
=
False
#deselect all objects
ob_new
.
select
=
True
bpy
.
context
.
scene
.
objects
.
active
=
ob_new
bpy
.
ops
.
object
.
mode_set
(
mode
=
'
OBJECT
'
)
#bpy.ops.object.mode_set(mode='EDIT')
print
(
"
number of bones:
"
,
len
(
obj
.
data
.
edit_bones
))
#for ib in range(len( obj.data.bones)):
#print("bone name:",obj.data.edit_bones[ib].name)
#print("bone name:",dir(bone))
#editbone = obj.data.edit_bones[ib]
#print("bone dir",dir(editbone))
#bpy.ops.object.mode_set(mode='EDIT')
print
(
"
=====================
"
)
#for bone in obj.data.edit_bones:
#print("bone name:",bone.name)
#print("edit bone name:",dir(bone))
print
(
"
=====================
"
)
print
(
"
data object:
"
,
dir
(
obj
.
data
))
bpy
.
ops
.
object
.
mode_set
(
mode
=
'
EDIT
'
)
for
bone
in
obj
.
data
.
bones
:
print
(
"
bone name:
"
,
bone
.
name
)
bpy
.
ops
.
object
.
mode_set
(
mode
=
'
EDIT
'
)
newbone
=
ob_new
.
data
.
edit_bones
.
new
(
bone
.
name
)
#print("parent:",bone.parent.name)
newbone
.
head
=
bone
.
head
newbone
.
tail
=
bone
.
tail
#newbone.roll = bone.roll
print
(
dir
(
bone
))
#print((bone.bbone_z))
#newbone.matrix = bone.matrix
newbone
.
roll
=
bone
.
bbone_z
if
bone
.
parent
!=
None
:
print
(
"
Found!
"
,
bone
.
parent
.
name
)
parentbone
=
ob_new
.
data
.
edit_bones
[
bone
.
parent
.
name
]
newbone
.
parent
=
parentbone
else
:
print
(
"
Not found!
"
)
newbone
.
head
=
bone
.
head_local
newbone
.
tail
=
bone
.
tail_local
#newbone.matrix = bone.matrix_local
#print(dir(newbone))
#if bone.name != bone.parent:
#print("parent:",bone.parent.name)
#parentbone = ob_new.data.edit_bones[bone.parent]
#newbone.parent = parentbone
'''
bpy.ops.object.mode_set(mode=
'
OBJECT
'
)#it need to go into object mode to able to select the faces
#print(
"
Mesh found!
"
,obj.name)
#print(len(obj.data.faces))
for face in obj.data.faces:
#print(dir(face))
if face.use_smooth == True:
face.select = True
#print(
"
selected:
"
,face.select)
else:
face.select = False
#print(
"
selected:
"
,face.select)
#print((
"
smooth:
"
,face.use_smooth))
#bpy.context.scene.update()
bpy.ops.object.mode_set(mode=
'
EDIT
'
)
'''
#bpy.context.scene.objects.link(ob_new)
bpy
.
context
.
scene
.
update
()
break
#objects = bpy.data.objects
return
{
'
FINISHED
'
}
def
menu_func
(
self
,
context
):
#bpy.context.scene.unrealexportpsk = True
#bpy.context.scene.unrealexportpsa = True
...
...
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