def meg_sub_data_loaded(): parent_obj = bpy.data.objects.get('Subcortical_structures') if parent_obj is None: return False else: parent_data = mu.count_fcurves(parent_obj) > 0 labels_data = mu.count_fcurves(parent_obj.children) > 0 return parent_data or labels_data
def meg_data_loaded(): parent_obj = bpy.data.objects.get('Brain') if parent_obj is None: return False else: parent_data = mu.count_fcurves(parent_obj) > 0 if bpy.data.objects.get('Cortex-lh') and bpy.data.objects.get('Cortex-rh'): labels = bpy.data.objects['Cortex-lh'].children + bpy.data.objects['Cortex-rh'].children labels_data = mu.count_fcurves(labels) > 0 return parent_data or labels_data else: return False
def meg_clusters_data_loaded(): try: meg_clusters_obj = bpy.data.objects.get(_addon().meg_panel_parent) return meg_clusters_obj is not None and mu.count_fcurves( meg_clusters_obj, recursive=True) > 0 except: return False
def electrodes_data_loaded(): try: electrodes_obj = bpy.data.objects.get(_addon().electrodes_panel_parent) return electrodes_obj is not None and mu.count_fcurves( electrodes_obj, recursive=True) > 0 except: return False
def select_all_rois(): mu.unfilter_graph_editor() fmri_parent = bpy.data.objects.get('fMRI') if mu.count_fcurves(bpy.data.objects['Brain']) > 0: bpy.context.scene.filter_curves_type = 'MEG' select_brain_objects('Brain', bpy.data.objects['Cortex-lh'].children + bpy.data.objects['Cortex-rh'].children) elif not fmri_parent is None: bpy.context.scene.filter_curves_type = 'fMRI' select_brain_objects('fMRI')
def select_brain_objects(parent_obj_name, children=None, exclude=[]): if children is None: children = bpy.data.objects[parent_obj_name].children parent_obj = bpy.data.objects[parent_obj_name] children_have_fcurves = mu.count_fcurves(children) > 0 parent_have_fcurves = not parent_obj.animation_data is None if parent_have_fcurves and (bpy.context.scene.selection_type == 'diff' or not children_have_fcurves): mu.show_hide_obj_and_fcurves(children, False) parent_obj.select = True mu.show_hide_obj_and_fcurves(parent_obj, True, exclude) elif children_have_fcurves: if bpy.context.scene.selection_type == 'diff': bpy.context.scene.selection_type = 'conds' mu.show_hide_obj_and_fcurves(children, True, exclude) parent_obj.select = False mu.view_all_in_graph_editor()
def select_roi(roi_name, change_selected_fcurves_colors=True): roi = bpy.data.objects.get(roi_name) if roi is None: return # check if MEG data is loaded and attahced to the obj if mu.count_fcurves(roi) > 0: roi.select = True labels_selection_coloring(roi_name) # mu.change_fcurves_colors(roi) else: # Check if dynamic fMRI data is loaded fmri_parent_obj = bpy.data.objects.get('fMRI') fcurves = mu.get_fcurves(fmri_parent_obj) for fcurve in fcurves: if mu.get_fcurve_name(fcurve) == roi_name: fcurve.hide = False fmri_parent_obj.select = True else: fcurve.hide = True if change_selected_fcurves_colors: mu.change_selected_fcurves_colors(mu.OBJ_TYPES_ROIS) mu.view_all_in_graph_editor()
def fmri_data_loaded(): fmri_parent_obj = bpy.data.objects.get('fMRI') return mu.count_fcurves(fmri_parent_obj) > 0