예제 #1
0
파일: scene.py 프로젝트: applekey/wizard
def select_objects(remote, objects_list):
    select_objects = mmapi.vectori();
    for object in objects_list:
        select_objects.push_back(object);
    cmd2 = mmapi.StoredCommands()
    cmd2.AppendSceneCommand_SelectObjects(select_objects)
    remote.runCommand(cmd2)
예제 #2
0
def select_objects(remote, objects_list):
    select_objects = mmapi.vectori()
    for object in objects_list:
        select_objects.push_back(object)
    cmd2 = mmapi.StoredCommands()
    cmd2.AppendSceneCommand_SelectObjects(select_objects)
    remote.runCommand(cmd2)
예제 #3
0
def list_objects(remote):
    """returns list of objects in scene"""
    cmd1 = mmapi.StoredCommands()
    key1 = cmd1.AppendSceneCommand_ListObjects()
    remote.runCommand(cmd1)
    objects = mmapi.vectori()
    cmd1.GetSceneCommandResult_ListObjects(key1, objects)
    return vectori_to_list(objects)
예제 #4
0
def append_objects_from_file(remote, filename):
    """returns list of new objects"""
    cmd = mmapi.StoredCommands()
    key = cmd.AppendSceneCommand_AppendMeshFile(filename)
    remote.runCommand(cmd)
    new_objs_vec = mmapi.vectori()
    cmd.GetSceneCommandResult_AppendMeshFile(key, new_objs_vec)
    return vectori_to_list(new_objs_vec)
예제 #5
0
def toolquery_new_groups(remote):
    """Get a list of new groups created by last tool (NOTE: many Tools do not support this yet!)"""
    cmd = mmapi.StoredCommands()
    key = cmd.AppendToolQuery_NewGroups()
    remote.runCommand(cmd)
    new_groups = mmapi.vectori()
    bOK = cmd.GetToolQueryResult_NewGroups(key, new_groups)
    return vectori_to_list(new_groups)
예제 #6
0
def list_selected_triangles(remote):
    """Returns a list of currently-selected triangles (requires an active selection)"""
    cmd1 = mmapi.StoredCommands()
    key1 = cmd1.AppendSelectCommand_ListSelectedTriangles()
    remote.runCommand(cmd1)
    groups1 = mmapi.vectori()
    cmd1.GetSelectCommandResult_ListSelectedTriangles(key1, groups1);
    return vectori_to_list(groups1);
예제 #7
0
파일: tool.py 프로젝트: applekey/wizard
def toolquery_new_groups(remote):
    """get list of new groups created by last tool"""
    cmd = mmapi.StoredCommands()
    key = cmd.AppendToolQuery_NewGroups()
    remote.runCommand(cmd)
    new_groups = mmapi.vectori()
    bOK = cmd.GetToolQueryResult_NewGroups(key, new_groups)
    return vectori_to_list(new_groups)
예제 #8
0
def toolquery_new_groups(remote):
    """get list of new groups created by last tool"""
    cmd = mmapi.StoredCommands()
    key = cmd.AppendToolQuery_NewGroups()
    remote.runCommand(cmd)
    new_groups = mmapi.vectori()
    bOK = cmd.GetToolQueryResult_NewGroups(key, new_groups)
    return vectori_to_list(new_groups)
예제 #9
0
파일: scene.py 프로젝트: applekey/wizard
def list_selected_groups(remote):
    """returns list of selected facegroup IDs"""
    cmd1 = mmapi.StoredCommands()
    key1 = cmd1.AppendSelectCommand_ListSelectedFaceGroups()
    remote.runCommand(cmd1)
    groups1 = mmapi.vectori()
    cmd1.GetSelectCommandResult_ListSelectedFaceGroups(key1, groups1);
    return vectori_to_list(groups1);
예제 #10
0
def list_selected_groups(remote):
    """returns list of selected facegroup IDs"""
    cmd1 = mmapi.StoredCommands()
    key1 = cmd1.AppendSelectCommand_ListSelectedFaceGroups()
    remote.runCommand(cmd1)
    groups1 = mmapi.vectori()
    cmd1.GetSelectCommandResult_ListSelectedFaceGroups(key1, groups1)
    return vectori_to_list(groups1)
예제 #11
0
파일: tool.py 프로젝트: 3DLIRIOUS/mm-api
def toolquery_new_groups(remote):
    """Get a list of new groups created by last tool (NOTE: many Tools do not support this yet!)"""
    cmd = mmapi.StoredCommands()
    key = cmd.AppendToolQuery_NewGroups()
    remote.runCommand(cmd)
    new_groups = mmapi.vectori()
    bOK = cmd.GetToolQueryResult_NewGroups(key, new_groups)
    return vectori_to_list(new_groups)
예제 #12
0
def append_objects_from_file(remote, filename):
    """Read objects from a mesh file, append them to the scene, and return a list of new object IDs"""
    cmd = mmapi.StoredCommands()
    key = cmd.AppendSceneCommand_AppendMeshFile(filename);
    remote.runCommand(cmd)
    new_objs_vec = mmapi.vectori()
    cmd.GetSceneCommandResult_AppendMeshFile(key, new_objs_vec)
    return vectori_to_list(new_objs_vec)
예제 #13
0
파일: scene.py 프로젝트: applekey/wizard
def append_objects_from_file(remote, filename):
    """returns list of new objects"""
    cmd = mmapi.StoredCommands()
    key = cmd.AppendSceneCommand_AppendMeshFile(filename);
    remote.runCommand(cmd)
    new_objs_vec = mmapi.vectori()
    cmd.GetSceneCommandResult_AppendMeshFile(key, new_objs_vec)
    return vectori_to_list(new_objs_vec)
예제 #14
0
파일: scene.py 프로젝트: jiapei100/mm-api
def list_selected_groups(remote):
    """Returns a list of unique facegroup IDs for the current face selection (requires an active selection)"""
    cmd1 = mmapi.StoredCommands()
    key1 = cmd1.AppendSelectCommand_ListSelectedFaceGroups()
    remote.runCommand(cmd1)
    groups1 = mmapi.vectori()
    cmd1.GetSelectCommandResult_ListSelectedFaceGroups(key1, groups1)
    return vectori_to_list(groups1)
예제 #15
0
파일: scene.py 프로젝트: jiapei100/mm-api
def select_objects(remote, objects_list):
    """Set the current objects selection to be the set of scene objects corresponding to the IDs in objects_list"""
    select_objects = mmapi.vectori()
    for object in objects_list:
        select_objects.push_back(object)
    cmd2 = mmapi.StoredCommands()
    cmd2.AppendSceneCommand_SelectObjects(select_objects)
    remote.runCommand(cmd2)
예제 #16
0
파일: scene.py 프로젝트: jiapei100/mm-api
def append_objects_from_file(remote, filename):
    """Read objects from a mesh file, append them to the scene, and return a list of new object IDs"""
    cmd = mmapi.StoredCommands()
    key = cmd.AppendSceneCommand_AppendMeshFile(filename)
    remote.runCommand(cmd)
    new_objs_vec = mmapi.vectori()
    cmd.GetSceneCommandResult_AppendMeshFile(key, new_objs_vec)
    return vectori_to_list(new_objs_vec)
예제 #17
0
파일: scene.py 프로젝트: jiapei100/mm-api
def list_selected_objects(remote):
    """Returns a list of object IDs for the current set of selected scene objects"""
    cmd1 = mmapi.StoredCommands()
    key1 = cmd1.AppendSceneCommand_ListSelectedObjects()
    remote.runCommand(cmd1)
    objects = mmapi.vectori()
    cmd1.GetSceneCommandResult_ListObjects(key1, objects)
    return vectori_to_list(objects)
예제 #18
0
def list_selected_triangles(remote):
    """Returns a list of currently-selected triangles (requires an active selection)"""
    cmd1 = mmapi.StoredCommands()
    key1 = cmd1.AppendSelectCommand_ListSelectedTriangles()
    remote.runCommand(cmd1)
    groups1 = mmapi.vectori()
    cmd1.GetSelectCommandResult_ListSelectedTriangles(key1, groups1)
    return vectori_to_list(groups1)
예제 #19
0
파일: scene.py 프로젝트: jiapei100/mm-api
def create_pivot(remote, frame):
    """create a pivot at a given mmFrame (not frame3f)"""
    cmd = mmapi.StoredCommands()
    cmd_key = cmd.AppendSceneCommand_CreatePivot(frame.get_frame3f())
    remote.runCommand(cmd)
    new_objs_vec = mmapi.vectori()
    cmd.GetSceneCommandResult_AppendMeshFile(cmd_key, new_objs_vec)
    return new_objs_vec[0]
예제 #20
0
파일: scene.py 프로젝트: dl2653/mm-api
def create_pivot(remote, frame):
    """create a pivot at a given mmFrame (not frame3f)"""
    cmd = mmapi.StoredCommands()
    cmd_key = cmd.AppendSceneCommand_CreatePivot( frame.get_frame3f() )
    remote.runCommand(cmd)
    new_objs_vec = mmapi.vectori()
    cmd.GetSceneCommandResult_AppendMeshFile(cmd_key, new_objs_vec)
    return new_objs_vec[0]
예제 #21
0
def list_selected_groups(remote):
    """Returns a list of unique facegroup IDs for the current face selection (requires an active selection)"""
    cmd1 = mmapi.StoredCommands()
    key1 = cmd1.AppendSelectCommand_ListSelectedFaceGroups()
    remote.runCommand(cmd1)
    groups1 = mmapi.vectori()
    cmd1.GetSelectCommandResult_ListSelectedFaceGroups(key1, groups1);
    return vectori_to_list(groups1);
예제 #22
0
파일: scene.py 프로젝트: applekey/wizard
def list_objects(remote):
    """returns list of objects in scene"""
    cmd1 = mmapi.StoredCommands()
    key1 = cmd1.AppendSceneCommand_ListObjects()
    remote.runCommand(cmd1)
    objects = mmapi.vectori()
    cmd1.GetSceneCommandResult_ListObjects(key1, objects)
    return vectori_to_list(objects)
예제 #23
0
def select_objects(remote, objects_list):
    """Set the current objects selection to be the set of scene objects corresponding to the IDs in objects_list"""
    select_objects = mmapi.vectori();
    for object in objects_list:
        select_objects.push_back(object);
    cmd2 = mmapi.StoredCommands()
    cmd2.AppendSceneCommand_SelectObjects(select_objects)
    remote.runCommand(cmd2)
예제 #24
0
def list_selected_objects(remote):
    """Returns a list of object IDs for the current set of selected scene objects"""
    cmd1 = mmapi.StoredCommands()
    key1 = cmd1.AppendSceneCommand_ListSelectedObjects()
    remote.runCommand(cmd1)
    objects = mmapi.vectori()
    cmd1.GetSceneCommandResult_ListObjects(key1, objects)
    return vectori_to_list(objects)
예제 #25
0
def select_triangles(remote, triangles_list, mode=0):
    """Select the listed triangles"""
    cmd = mmapi.StoredCommands()
    vtris = mmapi.vectori()
    for t in triangles_list:
        vtris.push_back(t)
    cmd2 = mmapi.StoredCommands()
    cmd2.AppendSelectCommand_ByTriangleID(vtris, mode)
    remote.runCommand(cmd2)
예제 #26
0
def select_triangles(remote, triangles_list, mode = 0):
    """Select the listed triangles"""
    cmd = mmapi.StoredCommands()
    vtris = mmapi.vectori();
    for t in triangles_list:
        vtris.push_back(t);
    cmd2 = mmapi.StoredCommands()
    cmd2.AppendSelectCommand_ByTriangleID(vtris, mode)
    remote.runCommand(cmd2)
예제 #27
0
def select_facegroups(remote, groups_list):
    """select facegroups"""
    cmd = mmapi.StoredCommands()
    vgroups = mmapi.vectori()
    for group in groups_list:
        vgroups.push_back(group)
    cmd2 = mmapi.StoredCommands()
    cmd2.AppendSelectCommand_ByFaceGroups(vgroups)
    remote.runCommand(cmd2)
예제 #28
0
def select_facegroups(remote, groups_list):
    """Select the faces which have a facegroup ID in groups_list"""
    cmd = mmapi.StoredCommands()
    vgroups = mmapi.vectori();
    for group in groups_list:
        vgroups.push_back(group);
    cmd2 = mmapi.StoredCommands()
    cmd2.AppendSelectCommand_ByFaceGroups(vgroups)
    remote.runCommand(cmd2)
예제 #29
0
def append_mesh_file(remote, dyr, nym, typ):
    cmd = mmapi.StoredCommands()
    input_file_name = dyr + nym + '.' + typ
    key = cmd.AppendSceneCommand_AppendMeshFile(input_file_name)
    remote.runCommand(cmd)
    objs_veci = mmapi.vectori()
    cmd.GetSceneCommandResult_AppendMeshFile(key, objs_veci)
    objs = vectori_to_list(objs_veci)
    print({
        'result_key_from_append_mesh': key,
        'asset_dir': dyr,
        'input_mesh_file_name': input_file_name,
        'input_mesh_file_type': typ,
        'first_obj': objs[0] if objs else None,
        'last_obj': objs[-1] if objs else None,
        'number_of_objs': len(objs)
    })
예제 #30
0
pathIn = txtfiles[0]

pathTemp = pathIn.split('.')

# out file
pathOut = pathTemp[0] + '_support.' + pathTemp[1]

# initialize connection
remote = mmRemote()
remote.connect()

# get all the objects
cmd1 = mmapi.StoredCommands()
key1 = cmd1.AppendSceneCommand_ListObjects()
remote.runCommand(cmd1)
objects = mmapi.vectori()
cmd1.GetSceneCommandResult_ListObjects(key1, objects)

# select all the objects
select_objects = mmapi.vectori()
for object in objects:
    select_objects.push_back(object)
cmd2 = mmapi.StoredCommands()
cmd2.AppendSceneCommand_SelectObjects(select_objects)
remote.runCommand(cmd2)

# delete all
cmd = mmapi.StoredCommands()
cmd.AppendSceneCommand_DeleteSelectedObjects()
remote.runCommand(cmd)