How can I delete with python some object in the node Mash/Repro ?

How can I delete with python some object in the node Mash/Repro ?

moiamy
Collaborator Collaborator
983 Views
1 Reply
Message 1 of 2

How can I delete with python some object in the node Mash/Repro ?

moiamy
Collaborator
Collaborator

Hello

I have 56 objects in my node repromesh.

I have listed all the attributes of this node, but can't figure how to delete one (or all) the object in order to replace them with another.

There are some attribute like : instancedGroup.instancedMesh but no value/type I can find.

 

repro.jpg

0 Likes
Accepted solutions (1)
984 Views
1 Reply
Reply (1)
Message 2 of 2

moiamy
Collaborator
Collaborator
Accepted solution

Below is the solution. Besides I have no idea how can I access some individual mesh inside the mash network, and give them different objectives.

 

import maya.OpenMayaUI as mui
from shiboken2 import wrapInstance 

usingPyside2 = False
try:
    import PySide2
    usingPyside2 = True
except:
    pass
from flux.imports import *
from flux.core import pix
import flux.core as fx

import mash_repro_aetemplate
import mash_repro_utils
from mash_repro_icons import MASH_REPRO_ICONS

from functools import partial
import MASH.undo as undo

def get_maya_window():
    ptr = mui.MQtUtil.mainWindow()
    if ptr is not None:
        return wrapInstance(long(ptr), qt.QMainWindow)

def refresh_all_aetemplates(force=False):
    """ Refresh all the repro aetemplates"""
    widgets = get_maya_window().findChildren(AEMASH_ReproTemplate) or []
    for widget in widgets:
        global SCENE_OPENED
        SCENE_OPENED = True
        widget.update_data(widget.node, force=force)
        SCENE_OPENED = False

widgets = get_maya_window().findChildren(qt.QWidget, 'AEMASH_ReproTemplate') or []

myRepro = widgets[0]

items_count = myRepro.objs_widget.topLevelItemCount()
for id in sorted(range(items_count), reverse=True):
    mash_repro_utils.remove_mesh_group(myRepro.objs_widget.node, id)
    myRepro.objs_widget.obj_dropped.emit(None)	

 

0 Likes