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)