def draw_item(self, context, layout, data, item, icon, active_data, active_propname, filter_flg): ob = data self.use_filter_sort_alpha = True coll = active_propname.strip("active_index") collection = getattr(bpy.data, coll) obj = collection.get(item.name) icon = get_icon(obj.type) if hasattr(obj, "type") else icon_from_bpy_datapath(repr(obj)) if self.layout_type in {'DEFAULT', 'COMPACT'}: layout.label(" %s" % (item.name), icon=icon) elif self.layout_type in {'GRID'}: layout.alignment = 'CENTER' layout.label(text="", icon=icon) return col.label(item.name) return
def draw_item(self, context, layout, data, item, icon, active_data, active_propname, filter_flg): ob = data self.use_filter_sort_alpha = True coll = active_propname.strip("active_index") collection = getattr(bpy.data, coll) obj = collection.get(item.name) icon = get_icon(obj.type) if hasattr( obj, "type") else icon_from_bpy_datapath(repr(obj)) if self.layout_type in {'DEFAULT', 'COMPACT'}: layout.label(" %s" % (item.name), icon=icon) elif self.layout_type in {'GRID'}: layout.alignment = 'CENTER' layout.label(text="", icon=icon) return col.label(item.name) return
def draw(self, context): layout = self.layout collection = self.collection scene = context.scene wm = context.window_manager dm = context.driver_manager search = getattr(scene.driver_objects, "search_%s" % self.collection, False) index = getattr(scene.driver_objects, "active_%s_index" % self.collection, -1) coll = getattr(scene.driver_objects, collection) layout.prop(scene.driver_objects, "search_%s" % self.collection) if getattr(scene.driver_objects, "search_%s" % self.collection): ui = layout.template_list("SD_%s_ui_list" % self.collection, "", scene.driver_objects, self.collection, scene.driver_objects, "active_%s_index" % self.collection, self.collection) # get_driven_scene_objects(scene) if self.collection.startswith("ob"): #dic = dm.get_driven_scene_objects(scene) ob = coll[index] if search else context.object keys = [ob.name] if ob is not None else [] elif self.collection.startswith("sce"): ob = context.scene keys = [ob.name] elif self.collection.startswith("mat"): ob = context.object.active_material keys = [ob.name] if ob is not None else [] elif self.collection.startswith("shape_keys"): ob = getattr(context.object.data, "shape_keys", None) keys = [ob.name] if ob is not None else [] else: #dic = dm.get_collection_dic(type(self).collection) ob = coll[index] keys = [ob.name] #keys = sorted(dic.keys()) if ob is None: layout.label("NO CONTEXT OBJECT") return None dm.check_deleted_drivers() dic = dm.get_object_dic(collection, ob.name) obj = getattr(bpy.data, collection).get(ob.name) # TO BE REFACTORED col = layout.column(align=True) icon = get_icon(obj.type) if hasattr( obj, "type") else icon_from_bpy_datapath(repr(obj)) row = col.row() row.alignment = 'LEFT' row.label(icon='DISCLOSURE_TRI_RIGHT', text="") if not search and collection.startswith("obj"): row.template_ID(context.scene.objects, "active") else: row.label(icon=icon, text=ob.name) #obj = dm.find(dic[m][0][0]).driven_object.id_data ''' dm.draw_layout(col, context, dic) #dm.check_added_drivers(ob) return None
def draw_header(self, context): #self.layout.prop(context.scene, "use_gravity", text="") collection = getattr(self, "collection", "objects") self.layout.label(icon=get_icon(collection), text=collection.title())
def draw(self, context): scene = context.scene layout = self.layout dns = bpy.app.driver_namespace box = layout dm = dns.get("DriverManager") UserPrefs = context.user_preferences if not UserPrefs.system.use_scripts_auto_execute: row = layout.row() row.prop(UserPrefs.system, "use_scripts_auto_execute") row = layout.row() row.label("Warning Will not work unless Auto Scripts Enabled", icon='ERROR') return if dm is None: #dm = DriverManager() box.label("No Driver Mangager", icon='INFO') row = box.row() row.operator("drivermanager.update") row = box.row() row.label("Once enabled will poll on drivers") return # dm.check_updates(context) row = box.row(align=True) if not len(dm._all_drivers_list): box.label("NO DRIVERS FOUND", icon='INFO') return ###dm.draw_menus(row, context) dm.draw_filters(self, context) return None # FIXME this can all go. ed = False settings = scene.driver_gui drivers_dict = dm.filter_dic seq_header, node_header = False, False for collname, collection in drivers_dict.items(): bpy_collection = getattr(bpy.data, collname) # need to reorder for sequencer and nodes. # check for filter FIXME if settings.use_filters: if hasattr(settings.filters, collname): if getattr(settings.filters, collname): continue row = box.row() icon = get_icon(collname) if not len(collection): continue for name, object_drivers in collection.items(): iobj = obj = bpy_collection.get(name) if hasattr(obj, "data") and obj.data is not None: iobj = obj.data if not obj: # a missing ob should invoke a dm refresh continue # XXX code for context ............................... _filter_context_object = True if (collname == 'objects' and _filter_context_object and (obj != context.object and obj not in context.selected_objects)): continue _filter_context_scene = True if (collname == 'scenes' and _filter_context_scene and (obj != context.scene)): continue # context world not in all spaces _filter_context_world = True if (collname == 'worlds' and _filter_context_world and hasattr(context, "world") and (obj != context.world)): continue row = box.row(align=True) row.label(text="", icon='DISCLOSURE_TRI_RIGHT') icon = get_icon(obj.rna_type.name) if hasattr(obj, "type"): icon = get_icon(obj.type) ''' if context.scene.objects.active == obj: row.template_ID(context.scene.objects, 'active') else: row.label(text="", icon=icon) row.prop(obj, "name", text="") ''' # TO BE REFACTORED row.label(text=obj.name, icon=icon) drivers = [ dm.find(sdi) for dp, ds in object_drivers.items() for i, sdi in ds.items() ] #REFACTO DLO #dm.draw_layout(layout, context, drivers) row = box.row() row.label("UPDATES %d" % dm.updates) '''
def draw(self, context): layout = self.layout collection = self.collection scene = context.scene wm = context.window_manager dm = context.driver_manager search = getattr(scene.driver_objects, "search_%s" % self.collection, False) index = getattr(scene.driver_objects, "active_%s_index" % self.collection, -1) coll = getattr(scene.driver_objects, collection) layout.prop(scene.driver_objects, "search_%s" % self.collection) if getattr(scene.driver_objects, "search_%s" % self.collection): ui = layout.template_list("SD_%s_ui_list" % self.collection, "", scene.driver_objects, self.collection, scene.driver_objects, "active_%s_index" % self.collection, self.collection) # get_driven_scene_objects(scene) if self.collection.startswith("ob"): #dic = dm.get_driven_scene_objects(scene) ob = coll[index] if search else context.object keys = [ob.name] if ob is not None else [] elif self.collection.startswith("sce"): ob = context.scene keys = [ob.name] elif self.collection.startswith("mat"): ob = context.object.active_material keys = [ob.name] if ob is not None else [] elif self.collection.startswith("shape_keys"): ob = getattr(context.object.data, "shape_keys", None) keys = [ob.name] if ob is not None else [] else: #dic = dm.get_collection_dic(type(self).collection) ob = coll[index] keys = [ob.name] #keys = sorted(dic.keys()) if ob is None: layout.label("NO CONTEXT OBJECT") return None dm.check_deleted_drivers() dic = dm.get_object_dic(collection, ob.name) obj = getattr(bpy.data, collection).get(ob.name) # TO BE REFACTORED col = layout.column(align=True) icon = get_icon(obj.type) if hasattr(obj, "type") else icon_from_bpy_datapath(repr(obj)) row = col.row() row.alignment = 'LEFT' row.label(icon='DISCLOSURE_TRI_RIGHT', text="") if not search and collection.startswith("obj"): row.template_ID(context.scene.objects, "active") else: row.label(icon=icon, text=ob.name) #obj = dm.find(dic[m][0][0]).driven_object.id_data ''' dm.draw_layout(col, context, dic) #dm.check_added_drivers(ob) return None
def draw_header(self, context): #self.layout.prop(context.scene, "use_gravity", text="") self.layout.label(icon=get_icon(self.collection), text=self.collection.title())
def draw(self, context): scene = context.scene layout = self.layout dns = bpy.app.driver_namespace box = layout dm = dns.get("DriverManager") UserPrefs = context.user_preferences if not UserPrefs.system.use_scripts_auto_execute: row = layout.row() row.prop(UserPrefs.system, "use_scripts_auto_execute") row = layout.row() row.label("Warning Will not work unless Auto Scripts Enabled", icon='ERROR') return if dm is None: #dm = DriverManager() box.label("No Driver Mangager", icon='INFO') row = box.row() row.operator("drivermanager.update") row = box.row() row.label("Once enabled will poll on drivers") return # dm.check_updates(context) row = box.row(align=True) if not len(dm._all_drivers_list): box.label("NO DRIVERS FOUND", icon='INFO') return ###dm.draw_menus(row, context) dm.draw_filters(self, context) return None # FIXME this can all go. ed = False settings = scene.driver_gui drivers_dict = dm.filter_dic seq_header, node_header = False, False for collname, collection in drivers_dict.items(): bpy_collection = getattr(bpy.data, collname) # need to reorder for sequencer and nodes. # check for filter FIXME if settings.use_filters: if hasattr(settings.filters, collname): if getattr(settings.filters, collname): continue row = box.row() icon = get_icon(collname) if not len(collection): continue for name, object_drivers in collection.items(): iobj = obj = bpy_collection.get(name) if hasattr(obj, "data") and obj.data is not None: iobj = obj.data if not obj: # a missing ob should invoke a dm refresh continue # XXX code for context ............................... _filter_context_object = True if (collname == 'objects' and _filter_context_object and (obj != context.object and obj not in context.selected_objects)): continue _filter_context_scene = True if (collname == 'scenes' and _filter_context_scene and (obj != context.scene)): continue # context world not in all spaces _filter_context_world = True if (collname == 'worlds' and _filter_context_world and hasattr(context, "world") and (obj != context.world)): continue row = box.row(align=True) row.label(text="", icon='DISCLOSURE_TRI_RIGHT') icon = get_icon(obj.rna_type.name) if hasattr(obj, "type"): icon = get_icon(obj.type) ''' if context.scene.objects.active == obj: row.template_ID(context.scene.objects, 'active') else: row.label(text="", icon=icon) row.prop(obj, "name", text="") ''' # TO BE REFACTORED row.label(text=obj.name, icon=icon) drivers = [dm.find(sdi) for dp, ds in object_drivers.items() for i, sdi in ds.items()] #REFACTO DLO #dm.draw_layout(layout, context, drivers) row = box.row() row.label("UPDATES %d" % dm.updates) '''
def draw_header(self, context): #self.layout.prop(context.scene, "use_gravity", text="") collection = getattr(self, "collection", "objects") self.layout.label(icon=get_icon(collection), text=collection.title())