I noticed the python code surrounding a Genesis 8 female is different ...How do I parent an object to the pelvis bone in python

Issue #1403 invalid
Joe Morris @ FAST Animation Studio Toolz created an issue

here's my code below:

this is the line that fails because there's no “select”parameter here it's only DAZ studio stuff, I checked in the console by hitting tab and that's all that came up

arma.select = True

I get the error':

Python: Traceback (most recent call last):
File "Z:\ZIP.TEMP\Super-Solid-Mode_v4_5_3\LIQUID.blend\bake.py", line 146, in <module>
AttributeError: 'Object' object has no attribute 'select'

here is code:

ob= bpy.data.objects['FLOW OBJECT']
arma = bpy.data.objects['Genesis 8 Female']

bpy.ops.object.select_all(action='DESELECT')
arma.select = True
bpy.context.scene.objects.active = arma

bpy.ops.object.mode_set(mode='EDIT')

parent_bone = 'pelvis' # choose the bone name which you want to be the parent

arma.data.edit_bones.active = arma.data.edit_bones[parent_bone]

bpy.ops.object.mode_set(mode='OBJECT')

bpy.ops.object.select_all(action='DESELECT') #deselect all objects
ob.select = True
arma.select = True
bpy.context.scene.objects.active = arma #the active object will be the parent of all selected object

bpy.ops.object.parent_set(type='BONE', keep_transform=True)

any help on this is appreciated

Comments (4)

  1. Thomas Larsson repo owner

    Objects are selected or deselected with the function select_set, e.g.

    arma.select_set(True)
    

    But this is not the place for general questions about Blender python. See the docs at https://docs.blender.org/api/3.4/ or ask questions e.g. on blenderartists.org.

  2. Joe Morris @ FAST Animation Studio Toolz reporter

    Thank you so much …the reason why I asked is the code surrounding this daz studio Genesis 8 armature seemed to be different and related to diffeomorphic somehow…thanks!

  3. Joe Morris @ FAST Animation Studio Toolz reporter

    can you update the thing that happens when you tab complete that So select_set shows up

  4. Log in to comment