Skip to content

Commit

Permalink
Add leaf bone option for eyeball bone generation and change eyeball b…
Browse files Browse the repository at this point in the history
…one extrusion to +X
  • Loading branch information
TiberiumFusion committed Sep 13, 2020
1 parent 0bb2282 commit 93a41e6
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
2 changes: 1 addition & 1 deletion io_scene_valvesource/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
bl_info = {
"name": "Blender Source Tools (BST-Fix+ for 2.79)",
"author": "Tom Edwards (translators: Grigory Revzin), modified by TF",
"version": (2, 10, 2, 999, 2),
"version": (2, 10, 2, 999, 3),
"blender": (2, 74, 0),
"category": "Import-Export",
"location": "File > Import/Export, Scene properties",
Expand Down
21 changes: 14 additions & 7 deletions io_scene_valvesource/import_smd.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,9 @@ class SmdImporter(bpy.types.Operator, Logger):
rotModes = ( ('XYZ', "Euler", ''), ('QUATERNION', "Quaternion", "") )
rotMode = EnumProperty(name=get_id("importer_rotmode"),items=rotModes,default='XYZ',description=get_id("importer_rotmode_tip"))
boneMode = EnumProperty(name=get_id("importer_bonemode"),items=(('NONE','Default',''),('ARROWS','Arrows',''),('SPHERE','Sphere','')),default='SPHERE',description=get_id("importer_bonemode_tip"))

createEyeballBones = BoolProperty(name=get_id("importert_doeyebones"), description=get_id("importert_doeyebones_tooltip"), default=False)

createEyeballBonesOpts = (("NONE", "None", "Don't create eyeball bones"), ("SINGLE", "Single Bone", "Create a single bone per eyeball"), ("WITHLEAF", "With Leaf Bone", "Create a two bones per eyeball, a basis bone and a leaf bone."))
createEyeballBones = EnumProperty(name=get_id("importert_doeyebones"), description=get_id("importert_doeyebones_tooltip"), items=createEyeballBonesOpts, default="NONE")

def execute(self, context):
pre_obs = set(bpy.context.scene.objects)
Expand Down Expand Up @@ -1156,7 +1157,7 @@ def import_file(word_index,default_ext,type,append='APPEND',layer=0,in_file_recu
continue

# define bones from qc eyeball commands
if createEyeballBones:
if createEyeballBones != "NONE":
if line[0] == "eyeball":
eyeballName = line[1]
parentBoneName = line[2]
Expand Down Expand Up @@ -1242,16 +1243,22 @@ def import_file(word_index,default_ext,type,append='APPEND',layer=0,in_file_recu

eyeballBone = qc.a.data.edit_bones.new(bonedef[0])
eyeballBone.head = (bonedef[2], bonedef[3], bonedef[4])
eyeballBone.tail = (bonedef[2], bonedef[3] - 0.25, bonedef[4])
eyeballBone.tail = (bonedef[2] + 0.1, bonedef[3], bonedef[4])
eyeballBone.parent = parentBone

createdBones.append(bonedef[0])

if createEyeballBones == "WITHLEAF":
leafEyeballBone = qc.a.data.edit_bones.new(bonedef[0] + "_end")
leafEyeballBone.head = eyeballBone.tail
leafEyeballBone.tail = (eyeballBone.tail[0] + 0.1, eyeballBone.tail[1], eyeballBone.tail[2])
leafEyeballBone.parent = eyeballBone
createdBones.append(bonedef[0] + "_end")

# Set visual bone model
ops.object.mode_set(mode='OBJECT')

for bonedef in qc.queued_eyebones:
qc.a.pose.bones[bonedef[0]].custom_shape = qc.bone_vis
for bonename in createdBones:
qc.a.pose.bones[bonename].custom_shape = qc.bone_vis


if qc.origin:
Expand Down

0 comments on commit 93a41e6

Please sign in to comment.