def DisableAddon(self, addon_name): addon_utils.disable(addon_name, default_set=True) addon_utils.modules_refresh() return { 'is_enabled': addon_utils.check(addon_name)[0], 'is_loaded': addon_utils.check(addon_name)[1], }
def register(): bpy.utils.register_module(__name__) addon_name = "proxy_refresh" addon_state = addon_utils.check( addon_name) # Returns: loaded_default, loaded_state addon_state_pr = addon_state[1] if not addon_state_pr: default_set = True # From addon_utils function persistent = True # From addon_utils function result = addon_utils.enable(addon_name, default_set, persistent) if result is None: # Add-on not found addon_state_pr = False addon_name = "addon_create_animation_scene" addon_state = addon_utils.check(addon_name) # loaded_default, loaded_state addon_state_acas = addon_state[1] if not addon_state_acas: default_set = True # From addon_utils function persistent = True # From addon_utils function result = addon_utils.enable(addon_name, default_set, persistent) if result is None: # Add-on not found addon_state_acas = False addon_name = "tangent_animation_outliner" addon_state = addon_utils.check(addon_name) # loaded_default, loaded_state addon_state_acas = addon_state[1] if not addon_state_acas: default_set = True # From addon_utils function persistent = True # From addon_utils function result = addon_utils.enable(addon_name, default_set, persistent) if result is None: # Add-on not found addon_state_acas = False
def execute(self, context): # disable all wrong versions for mod in addon_utils.modules(): if mod.bl_info['name'] == "Shotariya-don": if addon_utils.check(mod.__name__)[0]: try: bpy.ops.wm.addon_disable(module=mod.__name__) except: pass continue if mod.bl_info['name'] == "Shotariya's Material Combiner": if mod.bl_info['version'] < (2, 1, 1, 2) and addon_utils.check(mod.__name__)[0]: try: bpy.ops.wm.addon_disable(module=mod.__name__) except: pass continue # then enable correct version for mod in addon_utils.modules(): if mod.bl_info['name'] == "Shotariya's Material Combiner": if mod.bl_info['version'] < (2, 1, 1, 2): continue if not addon_utils.check(mod.__name__)[0]: bpy.ops.wm.addon_enable(module=mod.__name__) break self.report({'INFO'}, 'Enabled Material Combiner!') return {'FINISHED'}
def ListAddons(self, _): user_scripts_path = bpy.utils.user_resource('SCRIPTS') return {v.__name__: { 'is_enabled': addon_utils.check(v.__name__)[0], 'is_loaded': addon_utils.check(v.__name__)[1], 'is_user_addon': v.__file__.startswith(user_scripts_path), 'path': v.__file__ if not v.__file__.endswith('/__init__.py') else v.__file__[:-11], 'info': v.bl_info } for v in addon_utils.modules()}
def install_mmobj(): enabled,_ = addon_utils.check('io_scene_mmobj') if not enabled: addon_utils.enable('io_scene_mmobj', True) enabled,_ = addon_utils.check('io_scene_mmobj') if enabled: bpy.ops.wm.save_userpref() print(SUCCESS) else: # sys.exit(1) # this causes blender to die messily without setting the return code. so we'll just have to print the error print("MMERROR: Plugin failed to enable; install path may not be correct, or it is incompatible with this version of blender") else: print(SUCCESS)
def register(): for mod in addon_utils.modules(): if mod.bl_info.get('name', (-1, -1, -1)) == "Rigify": if not addon_utils.check(mod.__name__)[1]: addon_utils.enable(mod.__name__, default_set=True, handle_error=None) for cls in classes: bpy.utils.register_class(cls) wm = bpy.context.window_manager kc = wm.keyconfigs.addon if kc: km = kc.keymaps.new(name="3D View", space_type="VIEW_3D") kmi = km.keymap_items.new("wm.call_menu", type="A", value="PRESS", shift=True, ctrl=True) kmi.properties.name = "RIGIFY_PARTS_MT_add_master_menu" addon_keymaps.append([km, kmi])
def get_addon(addon, debug=False): """ look for addon by name and find folder name and path Note, this will also find addons that aren't registered! """ import addon_utils for mod in addon_utils.modules(): name = mod.bl_info["name"] version = mod.bl_info.get("version", None) foldername = mod.__name__ path = mod.__file__ enabled = addon_utils.check(foldername)[1] if name == addon: if debug: print(name) print(" enabled:", enabled) print(" folder name:", foldername) print(" version:", version) print(" path:", path) print() return enabled, foldername, version, path return None, None, None, None
def dump_addon_messages(module_name, messages_formats, do_checks, settings): # Enable our addon and get strings from RNA. addon = enable_addons(addons={module_name})[0] addon_info = addon_utils.module_bl_info(addon) ver = addon_info.name + " " + ".".join(addon_info.version) rev = "???" date = datetime.datetime() pot = utils.I18nMessages.gen_empty_messages(settings.PARSER_TEMPLATE_ID, ver, rev, date, date.year, settings=settings) msgs = pot.msgs minus_msgs = copy.deepcopy(msgs) check_ctxt = _gen_check_ctxt(settings) if do_checks else None minus_check_ctxt = _gen_check_ctxt(settings) if do_checks else None # Get current addon state (loaded or not): was_loaded = addon_utils.check(module_name)[1] # Enable our addon and get strings from RNA. addons = enable_addons(addons={module_name}) reports = _gen_reports(check_ctxt) dump_messages_rna(msgs, reports, settings) # Now disable our addon, and rescan RNA. enable_addons(addons={module_name}, disable=True) reports["check_ctxt"] = minus_check_ctxt dump_messages_rna(minus_msgs, reports, settings) # Restore previous state if needed! if was_loaded: enable_addons(addons={module_name}) # and make the diff! for key in minus_msgs: if key == settings.PO_HEADER_KEY: continue del msgs[key] if check_ctxt: for key in check_ctxt: for warning in minus_check_ctxt[key]: check_ctxt[key].remove(warning) # and we are done with those! del minus_msgs del minus_check_ctxt # get strings from UI layout definitions text="..." args reports["check_ctxt"] = check_ctxt dump_messages_pytext(msgs, reports, addons, settings, addons_only=True) print_info(reports, pot) return pot
def ensure_addons(): # TODO: Persist addons being enabled as user settings (otherwise overhead!) for addon in ('blend4web', 'render_freestyle_svg'): is_enabled, is_loaded = check(addon) if not is_enabled: bpy.ops.wm.addon_enable(module=addon)
def check_for_smc(): global draw_smc_ui, old_smc_version, smc_is_disabled, found_very_old_smc draw_smc_ui = None found_very_old_smc = False for mod in addon_utils.modules(): if mod.bl_info['name'] == "Shotariya-don": if hasattr(bpy.context.scene, 'shotariya_tex_idx'): found_very_old_smc = True continue if mod.bl_info['name'] == "Shotariya's Material Combiner": # print(mod.__name__, mod.bl_info['version']) # print(addon_utils.check(mod.__name__)) if mod.bl_info['version'] < (2, 1, 1, 2): old_smc_version = True # print('TOO OLD!') continue if not addon_utils.check(mod.__name__)[0]: smc_is_disabled = True # print('DISABLED!') continue # print('FOUND!') old_smc_version = False smc_is_disabled = False found_very_old_smc = False draw_smc_ui = getattr(import_module(mod.__name__ + '.operators.ui.include'), 'draw_ui') break
def draw(self, context): layout = self.layout icons = load_icons() layout.scale_y = 1.3 layout.operator_context = 'INVOKE_REGION_WIN' button_align_straigten = icons.get("icon_align_straigten") layout.operator("mesh.vertex_align", text="Straigten", icon_value=button_align_straigten.icon_id) button_align_distribute = icons.get("icon_align_distribute") layout.operator("mesh.vertex_distribute", text="Distribute", icon_value=button_align_distribute.icon_id) button_align_unbevel = icons.get("icon_align_unbevel") layout.operator("tp_ops.unbevel", text="Unbevel", icon_value=button_align_unbevel.icon_id) imdjs_tools_addon = "IMDJS_mesh_tools" state = addon_utils.check(imdjs_tools_addon) if not state[0]: pass else: button_align_radians = icons.get("icon_align_radians") layout.operator("mesh.round_selected_points", text="Radians", icon_value=button_align_radians.icon_id)
def checkMakeSkinAvailable(): for path in paths(): for mod_name, mod_path in bpy.path.module_names(path): is_enabled, is_loaded = check(mod_name) if mod_name == "makeskin": return is_enabled and is_loaded return False
def draw(self, context): box = self.layout.box() box.label("General Options:", icon='FILE_FOLDER') box.prop(self, "game_path") if not self.game_path: box.label("Please set a vol directory path.", icon='ERROR') elif not os.path.isdir(os.path.join(self.game_path, "content")): box.label( "Invalid vol directory. It does not have a content subfolder.", icon='ERROR') elif not os.path.isfile( os.path.join(self.game_path, "content", "data", "objflow.byaml")): box.label( "Invalid vol directory. It does not have a 'objflow.byaml' file in '/content/data/objflow.byaml'.", icon='ERROR') else: box.label("The vol path is valid!", icon='FILE_TICK') box.prop(self, "debug_mode") box = self.layout.box() box.label("Visualization Options:", icon='RESTRICT_VIEW_OFF') row = box.row() if addon_utils.check("io_scene_bfres")[1]: row.prop(self, "lod_model_index") row.prop(self, "import_all_textures") else: row.label("io_scene_bfres not installed.", icon='ERROR')
def _main(args): try: myArgumentIndex = next(i for i, v in enumerate(sys.argv) if v == "--") args = args[myArgumentIndex + 1:] except StopIteration: print( "Error: No .EDM files passed for opening. Rememeber to separate from blender arguments with '--'" ) return -1 print("Reading", args) default, state = addon_utils.check("io_EDM") if not state: import io_EDM io_EDM.register() # Should get rid of all objects for simple read script for obj in bpy.context.scene.objects: if obj.type == "CAMERA": continue bpy.context.scene.objects.unlink(obj) # Call the import operator bpy.ops.import_mesh.edm(filepath=args[0], shadeless=True)
class OscPanelNlaOffset(bpy.types.Panel): bl_space_type = 'VIEW_3D' bl_region_type = 'TOOLS' bl_label = "Action Offset" bl_category = "Oscurart Tools" if check( "oscurart_tools")[0] else "Action Offset" def draw(self, context): active_obj = context.active_object layout = self.layout col = layout.column(align=1) col.operator("nla.create_offset_cp", icon="LINENUMBERS_ON", text="Set Order") col.operator("nla.create_action_cp", icon="POSE_DATA", text="Set Action Object!") col.label(text="Active Action: %s" % (bpy.context.scene.nla_offset_action)) col = layout.column(align=0) row = col.row(align=0) row.operator("nla.strip_offset", icon="NLA") row.operator("constraint.offset_action_cns", icon="CONSTRAINT")
def remesh(self, context): lr = self.copiedobject hr = self.initialobject if self.manifold_method == "print3d": isloaded = addon_utils.check("object_print3d_utils")[0] if not isloaded: addon_utils.enable("object_print3d_utils") bpy.ops.mesh.print3d_clean_non_manifold() if not isloaded: addon_utils.disable("object_print3d_utils") elif self.manifold_method == "fill": bpy.ops.object.editmode_toggle() bpy.ops.mesh.select_mode(type="EDGE") bpy.ops.mesh.select_all(action='DESELECT') bpy.ops.mesh.select_non_manifold() bpy.ops.mesh.fill() bpy.ops.object.editmode_toggle() elif self.manifold_method == "manifold": self.report({"ERROR"}, "Manifold is not implemented yet") return {"CANCELLED"} elif self.manifold_method == "meshlab": self.report({"ERROR"}, "Meshlab manifolding is not implemented yet") return {"CANCELLED"} return {"FINISHED"}
def draw(self, context): layout = self.layout icons = load_icons() layout.scale_y = 1.3 layout.operator_context = 'INVOKE_REGION_WIN' button_align_straigten = icons.get("icon_align_straigten") layout.operator("mesh.vertex_align",text="Straigten", icon_value=button_align_straigten.icon_id) button_align_distribute = icons.get("icon_align_distribute") layout.operator("mesh.vertex_distribute",text="Distribute", icon_value=button_align_distribute.icon_id) button_align_unbevel = icons.get("icon_align_unbevel") layout.operator("tp_ops.unbevel",text="Unbevel", icon_value=button_align_unbevel.icon_id) imdjs_tools_addon = "IMDJS_mesh_tools" state = addon_utils.check(imdjs_tools_addon) if not state[0]: pass else: button_align_radians = icons.get("icon_align_radians") layout.operator("mesh.round_selected_points", text="Radians", icon_value=button_align_radians.icon_id)
def draw(self, context): layout = self.layout icons = load_icons() layout.operator_context = 'INVOKE_REGION_WIN' button_align_vertices = icons.get("icon_align_vertices") layout.operator("mesh.vertices_smooth","Smooth Verts", icon_value=button_align_vertices.icon_id) button_align_laplacian = icons.get("icon_align_laplacian") layout.operator("mesh.vertices_smooth_laplacian","Smooth Laplacian", icon_value=button_align_laplacian.icon_id) button_align_shrinkwrap = icons.get("icon_align_shrinkwrap") layout.operator("mesh.shrinkwrap_smooth","Smooth Shrinkwrap", icon_value=button_align_shrinkwrap.icon_id) Display_Looptools = context.user_preferences.addons[__package__].preferences.tab_looptools if Display_Looptools == 'on': loop_tools_addon = "mesh_looptools" state = addon_utils.check(loop_tools_addon) if not state[0]: pass else: button_align_looptools = icons.get("icon_align_looptools") layout.operator("mesh.looptools_relax", text="LT Smooth Relax", icon_value=button_align_looptools.icon_id)
def register(): # load dependency add-ons import addon_utils for addon_id in addon_dependencies: default_state, loaded_state = addon_utils.check(addon_id) if not loaded_state: addon_utils.enable(addon_id, default_set=False, persistent=True) # load BlenRig internal classes for c in armature_classes: bpy.utils.register_class(c) for c in alignment_classes: bpy.utils.register_class(c) for c in snapping_classes: bpy.utils.register_class(c) for c in body_picker_biped_classes: bpy.utils.register_class(c) for c in body_picker_quadruped_classes: bpy.utils.register_class(c) for c in face_picker_classes: bpy.utils.register_class(c) for c in blenrig_rigs_classes: bpy.utils.register_class(c) # BlenRig Props bpy.types.WindowManager.blenrig_5_props = bpy.props.PointerProperty(type = Blenrig_5_Props) # BlenRig Object Add Panel bpy.types.INFO_MT_armature_add.append(blenrig5_add_menu_func)
def set_models(ob, name): # If possible, attach child mesh objects (requires models to be available, io_scene_bfres and no existing children). if name in _empty_models or not addon_utils.check( "io_scene_bfres")[1] or len(ob.children): return # Get the model or load it if it does not exist yet. model_ob = bpy.data.objects.get("MK8.{}".format(name)) if not model_ob: model_ob = _load_model(name) if not model_ob: log(0, "Warning: No model found for '{}'.".format(name)) _empty_models.append(name) return model_ob.name = "MK8.{}".format(name) # Link-clone the child objects and attach them to the given parent. for child in model_ob.children: child_ob = bpy.data.objects.new(child.name, child.data) child_ob.mk8.object_type = "ADDON_VISUALIZER" child_ob.parent = ob child_ob.lock_location = [True] * 3 child_ob.lock_rotation = [True] * 3 child_ob.lock_scale = [True] * 3 bpy.context.scene.objects.link(child_ob) bpy.context.scene.update( ) # Required to find the children at the parent's transform eventually.
def import_file(self, f): ''' Imports an obj file and returns the name of the object ''' old_stdout = sys.stdout old_stderr = sys.stderr dvnull = open(devnull, 'w') sys.stdout = sys.stderr = dvnull # Check if obj importer is enabled if not addon_utils.check("io_scene_obj")[1]: # Enable it if not addon_utils.enable("io_scene_obj"): self.report({'ERROR'}, "could not load obj importer, aborting...") # try: bpy.ops.import_scene.obj(filepath=f, axis_forward='-Z', axis_up='Y', use_edges=True, use_smooth_groups=True, use_split_objects=False, use_split_groups=False, use_groups_as_vgroups=False, use_image_search=True, split_mode='OFF', global_clamp_size=0) # except AttributeError: # self.report({'ERROR'}, "obj importer not loaded, aborting...") sys.stdout = old_stdout sys.stderr = old_stderr return self.rename_object(f)
def unregister(): bpy.types.INFO_MT_file_export.remove(menu_func_export) bpy.types.INFO_MT_file_import.remove(menu_func_import) # gracefully co-exist with neverblender, within reason. # if neverblender is enabled and disabled while kotorblender # is enabled, kotorblender will be left in an error state # and must be re-enabled to resume normal functionality try: (load_dflt, nvb_loaded) = addon_utils.check('neverblender') if nvb_loaded: # this will cleanly reload neverblender so that nvb # will function after kotorblender has been disabled # NOTE: the user was warned not to do this, but help anyway import neverblender neverblender.unregister() # these are the attributes we share with nvb, # we could rename, but it would change a great deal of code, # it is better to keep the code similar enough to contribute if 'nvb' in dir(bpy.types.Object): del bpy.types.Object.nvb if 'nvb' in dir(bpy.types.ImageTexture): del bpy.types.ImageTexture.nvb neverblender.register() except: del bpy.types.Object.nvb del bpy.types.ImageTexture.nvb bpy.utils.unregister_module(__name__)
def import_file(self, f): ''' Imports an obj file and returns the name of the object ''' old_stdout = sys.stdout old_stderr = sys.stderr dvnull = open(devnull, 'w') sys.stdout = sys.stderr = dvnull # Check if obj importer is enabled if not addon_utils.check("io_scene_obj")[1]: # Enable it if not addon_utils.enable("io_scene_obj"): self.report({'ERROR'}, "could not load obj importer, aborting...") # try: bpy.ops.import_scene.obj( filepath=f, axis_forward='-Z', axis_up='Y', use_edges=True, use_smooth_groups=True, use_split_objects=False, use_split_groups=False, use_groups_as_vgroups=False, use_image_search=True, split_mode='OFF', global_clamp_size=0) # except AttributeError: # self.report({'ERROR'}, "obj importer not loaded, aborting...") sys.stdout = old_stdout sys.stderr = old_stderr return self.rename_object(f)
def get_addon(addon, debug=False): """ look for addon by name return registration status, foldername, version and path """ import addon_utils for mod in addon_utils.modules(): name = mod.bl_info["name"] version = mod.bl_info.get("version", None) foldername = mod.__name__ path = mod.__file__ enabled = addon_utils.check(foldername)[1] if name == addon: if debug: print(name) print(" enabled:", enabled) print(" folder name:", foldername) print(" version:", version) print(" path:", path) print() return enabled, foldername, version, path return False, None, None, None
def invoke( self, context: bpy.types.Context, event: bpy.types.Event) -> set: # pylint: disable=unused-argument """Init operator when invoked. Arguments: context {bpy.types.Context} -- invoke context event {bpy.types.Event} -- invoke event Returns: set -- enum set in {‘RUNNING_MODAL’, ‘CANCELLED’, ‘FINISHED’, ‘PASS_THROUGH’, ‘INTERFACE’} """ # check cycles availability if addon_utils.check("cycles")[1] is False: msg = "Cycles is required but not enabled on your install. Please enable it in Preferences." self.report({'ERROR'}, msg) logger.error(msg) return {'CANCELLED'} # # compute a default sphere-wall radius self.scene_bbox = SceneBoundingBox( context.scene) # type: SceneBoundingBox dist1 = euclidean_distance(self.scene_bbox.center, self.scene_bbox.get_min_vector()) dist2 = euclidean_distance(self.scene_bbox.center, self.scene_bbox.get_max_vector()) self.sphere_radius = max(dist1, dist2) * 20. # wm = context.window_manager return wm.invoke_props_dialog(self)
def execute(self, context): try: state = addon_utils.check("mesh_looptools") print(state) if not state[0]: bpy.ops.wm.addon_enable(module="mesh_looptools") except: self.report({'ERROR'}, "Loop Tools not installed.") return {'CANCELLED'} scene = context.scene src_obj = scene.objects.active try: do_boolean(scene, src_obj, self.union_path) create_bevel(scene, src_obj, self.fillet_profile, self.fillet_segments, self.triangulate, self.smooth_bevel, self.method, self.smooth_bevel_value, self.smooth_bevel_step, "NoName") if self.use_material: set_material(self.smooth_bevel, src_obj, "NoName_") except: pass if self.remove: clear_objects(scene, src_obj) return {'FINISHED'}
def poll(cls, context): loaded, state = addon_utils.check('bone_selection_sets') if not loaded: return False return (context.object and context.object.type == 'ARMATURE' and context.mode == 'POSE')
def addon_is_enabled(self, context, addon_name): try: default,state = addon_utils.check(addon_name) if state: return True except: pass return False
def perform_check(): for addon in addon_dependencies: if addon in addons: is_enabled, is_loaded = check(addon) if not is_enabled: enable(addon) else: print("!Dependency %s missing!" % addon)
def tex2vc(mesh_object, alpha_color=(0, 0, 0), replace_active_layer=True, mappingMode='CLIP', blendingMode='MULTIPLY', mirror_x=False, mirror_y=False, del_tex=True): """Transfer texture colors to vertex colors alpha_color: betweeon 0 and 1 replace_active_layer (bool) mappingMode (enum in 'CLIP', 'REPEAT', 'EXTEND') blendingMode (enum in ['MIX', 'ADD', 'SUBTRACT', 'MULTIPLY', 'SCREEN', 'OVERLAY', 'DIFFERENCE', 'DIVIDE', 'DARKEN', 'LIGHTEN', 'HUE', 'SATURATION', 'VALUE', 'COLOR', 'SOFT_LIGHT', 'LINEAR_LIGHT']) mirror_x (bool) mirror_y (bool) del_tex (bool): delete texture and material after conversion """ # Deselect All bpy.ops.object.select_all(action='DESELECT') # Select Source and make active mesh_object.select = True bpy.context.scene.objects.active = mesh_object """ # http://blender.stackexchange.com/questions/15638/how-to-distinguish-between-addon-is-not-installed-and-addon-is-not-enabled mod = None addon_name = 'uv_bake_texture_to_vcols' if addon_name not in addon_utils.addons_fake_modules: print("%s: Addon not installed." % addon_name) else: is_enabled, is_loaded = addon_utils.check(addon_name) if not is_loaded: try: mod = addon_utils.enable(addon_name, default_set=False, persistent=False) except: print("%s: Could not enable Addon on the fly." % addon_name ) if mod: print("%s: enabled and running." % addon_name) """ # Ensure that uv_bake_texture_to_vcols add-on is loaded and enabled is_enabled, is_loaded = addon_utils.check('uv_bake_texture_to_vcols') if not is_enabled: #print("%s enabled" % addon) addon_utils.enable('uv_bake_texture_to_vcols') bpy.context.scene.uv_bake_alpha_color = alpha_color bpy.ops.uv.bake_texture_to_vcols(replace_active_layer=replace_active_layer, mappingMode=mappingMode, blendingMode=blendingMode, mirror_x=mirror_x, mirror_y=mirror_y) if del_tex: remove_tex_color(mesh_object=mesh_object) return None
def draw(self, context): layout = self.layout layout.scale_y = 1.2 meshmaschine_addon = "MESHmachine" state = addon_utils.check(meshmaschine_addon) if not state[0]: layout.label("Please activate MESHmachine") else: # MAIN ------------------------------------------------------- # Fuse op = layout.operator("machin3.fuse", text="Fuse") op.width = 0 op.reverse = False # Chamfer Width op = layout.operator("machin3.change_width", text="Width") op.width = 0 # Flatten layout.operator("machin3.flatten", text="Flatten") # UN-TOOLS ------------------------------------------------------- layout.separator() # Unf*ck op = layout.operator("machin3.unfuck", text="Unf*ck") op.propagate = 0 op.width = 0 # Unfuse op = layout.operator("machin3.unfuse", text="Unfuse") # Refuse op = layout.operator("machin3.refuse", text="Refuse") op.width = 0 op.reverse = False op.init = True # Unbevel op = layout.operator("machin3.unbevel", text="Unbevel") # Unchamfer layout.operator("machin3.unchamfer", text="Unchamfer") # CORNER TOOLS ------------------------------------------------------- layout.separator() # Turn Corner layout.operator("machin3.turn_corner", text="Turn Corner") # Quad Corner layout.operator("machin3.quad_corner", text="Quad Corner")
def get_loaded_addons(): paths_list = paths() addon_list = [] for path in paths_list: for mod_name, mod_path in bpy.path.module_names(path): is_enabled, is_loaded = check(mod_name) if is_enabled and is_loaded: addon_list.append(mod_name) return addon_list
def enable_rpr(case): event('Load rpr', True, case) if not addon_utils.check('rprblender')[0]: addon_utils.enable('rprblender', default_set=True, persistent=False, handle_error=None) set_value(bpy.context.scene.render, 'engine', 'RPR') event('Load rpr', False, case)
def setupCleanBlenderEnvironment(self): name = 'arx_addon' import addon_utils from bpy import context # Disable the module first to prevent log spam for module in addon_utils.modules(): if module.__name__ == name: is_enabled, is_loaded = addon_utils.check(name) if is_loaded: addon_utils.disable(name) #bpy.ops.wm.read_homefile() bpy.ops.wm.read_factory_settings() #addon_utils.modules_refresh() moduleFound = False for module in addon_utils.modules(): if module.__name__ == name: default, enable = addon_utils.check(name) if not enable: addon_utils.enable(name, default_set=True, persistent=False, handle_error=None) context.user_preferences.addons[ name].preferences.arxAssetPath = self.dataDirectory moduleFound = True if not moduleFound: raise Exception("Addon not found: {0}".format(name)) # Cleanup the default scene def removeObj(name): defaultCube = bpy.context.scene.objects.get(name) if defaultCube: defaultCube.select = True bpy.ops.object.delete() removeObj('Cube') removeObj('Camera') removeObj('Lamp')
def execute(self, context): # check for needed addons loop_tools_addon = "mesh_looptools" state = addon_utils.check(loop_tools_addon) if not state[0]: bpy.ops.wm.addon_enable(module=loop_tools_addon) print(self) self.report({'INFO'}, "LoopTools activated!") return {'FINISHED'}
def checkAddon(addon_name): '''Check is an addon is installed and enable it if needed''' addon_utils.modules_refresh() if addon_name not in addon_utils.addons_fake_modules: raise ImportError("%s addon not installed." % addon_name) else: default, enable = addon_utils.check(addon_name) #>>Warning: addon-module 'geoscene' found module but without __addon_enabled__ field, possible name collision if not enable: addon_utils.enable(addon_name, default_set=True, persistent=False)
def execute(self, context): # check for needed addons auto_mirror_addon = "mesh_auto_mirror" state = addon_utils.check(auto_mirror_addon) if not state[0]: bpy.ops.wm.addon_enable(module=auto_mirror_addon) print(self) self.report({'INFO'}, "AutoMirror activated!") return {'FINISHED'}
def execute(self, context): # check for needed addons mesh_tiny_cad_addon = "mesh_tiny_cad" state = addon_utils.check(mesh_tiny_cad_addon) if not state[0]: bpy.ops.wm.addon_enable(module=mesh_tiny_cad_addon) print(self) self.report({'INFO'}, "TinyCAD activated!") return {'FINISHED'}
def setupCleanBlenderEnvironment(self): name = 'arx_addon' import addon_utils from bpy import context # Disable the module first to prevent log spam for module in addon_utils.modules(): if module.__name__ == name: is_enabled, is_loaded = addon_utils.check(name) if is_loaded: addon_utils.disable(name) #bpy.ops.wm.read_homefile() bpy.ops.wm.read_factory_settings() #addon_utils.modules_refresh() moduleFound = False for module in addon_utils.modules(): if module.__name__ == name: default, enable = addon_utils.check(name) if not enable: addon_utils.enable(name, default_set=True, persistent=False, handle_error=None) context.user_preferences.addons[name].preferences.arxAssetPath = self.dataDirectory moduleFound = True if not moduleFound: raise Exception("Addon not found: {0}".format(name)) # Cleanup the default scene def removeObj(name): defaultCube = bpy.context.scene.objects.get(name) if defaultCube: defaultCube.select = True bpy.ops.object.delete() removeObj('Cube') removeObj('Camera') removeObj('Lamp')
def register(): bpy.utils.register_module(__name__) bpy.types.Screen.tangent_outliner = bpy.props.PointerProperty(type = TA_Outliner) addon_name = "proxy_refresh" addon_state = addon_utils.check(addon_name) # Returns: loaded_default, loaded_state addon_state_pr = addon_state[1] if not addon_state_pr: default_set=True # From addon_utils function persistent=True # From addon_utils function result = addon_utils.enable(addon_name, default_set, persistent) if result is None: # Add-on not found addon_state_pr = False addon_name = "addon_create_animation_scene" addon_state = addon_utils.check(addon_name) # loaded_default, loaded_state addon_state_acas = addon_state[1] if not addon_state_acas: default_set=True # From addon_utils function persistent=True # From addon_utils function result = addon_utils.enable(addon_name, default_set, persistent) if result is None: # Add-on not found addon_state_acas = False
def requiredAddons(self): bpy.types.RENDER_PT_render.bl_options = {'DEFAULT_CLOSED'} for addon in _ADDONS_FOR_PROJECT: addon_status = addon_utils.check(addon) if addon_status[0] == True: if bpy.app.debug: print("{0} is already loaded so disabling it".format(addon)) bpy.ops.wm.addon_disable(module=addon) #continue try: bpy.ops.wm.addon_enable(module=addon) except AttributeError as e: print(e) else: if bpy.app.debug: print("Loaded {0}".format(addon))
def handler_post_load(dummy): print('debug post load handler') if addon_utils.check("piemenus")[1]: print('made bpy.data ready for pies') #load the icon image in case it's not there img = bpy.data.images.get('blender_icons_x2.png') if not img: #load the icon image into blend data. addons_folder = os.path.dirname(__file__) icondir=os.path.join(addons_folder, 'icons','blender_icons') pie_menu_utils.icons_to_blend_data(icondir) img = bpy.data.images['blender_icons_x2.png'] img.gl_load() #set the icon loaded property to True and remember the bindcode scn = bpy.context.scene scn.piemenus.pieIconBindcode = img.bindcode if not len(scn.pie_settings): scn.piemenus.initSceneProperties()
def draw(self, context): layout = self.layout # INFO # row= layout.row(align=True) row.prop(self, "prefs_tabs", expand=True) if self.prefs_tabs == 'info': box = layout.box().column(1) row = box.column(1) row.label(text="Welcome to T+ Align!") row.label(text="This is a collection of align tools for 3D View, UV Image-, Graph and Node Editor") row.label(text="Location in 3D View: tool shelf [T], property Shelf [N], properties data and header line") row.label(text="Menu in UV Image-, Graph and Node Editor: [CTRL+D]") row.separator() row.label(text="Advanced: looptools and automirror can be added to the panel and menus.") row.label(text="Go to > addon preferences > tools > choose on or off.") row.label(text="Activation buttons appears if they are not already actively switched.") row.label(text="Save user settings for a permant use.") row.separator() row.label(text="Have Fun! :)") # LOCATIONS # if self.prefs_tabs == 'location': box = layout.box().column(1) row = box.row(1) row.label("Location: ") box.separator() row = box.row(1) row.prop(self, 'tab_location_align', expand=True) if self.tab_location_align == 'tools': box.separator() row = box.row(1) row.prop(self, "tools_category_align") # TOOLS # if self.prefs_tabs == 'tools': box = layout.box().column(1) row = box.row() row.label("Panel Tools:", icon ="COLLAPSEMENU") row = box.column_flow(2) row.prop(self, 'tab_origin') row.prop(self, 'tab_align_to') row.prop(self, 'tab_aligner') row.prop(self, 'tab_zero_to') row.prop(self, 'tab_station') row.prop(self, 'tab_interpolate') row.prop(self, 'tab_mirror') row.prop(self, 'tab_automirror') row.prop(self, 'tab_looptools') row.prop(self, 'tab_relax') row.prop(self, 'tab_edger') row.prop(self, 'tab_space') row.prop(self, 'tab_machine') box.separator() box.separator() row = box.row() row.label("Menu Tools:", icon ="COLLAPSEMENU") row = box.column_flow(2) row.prop(self, 'tab_pivot_menu') row.prop(self, 'tab_origin_menu') row.prop(self, 'tab_align_to_menu') row.prop(self, 'tab_aligner_menu') row.prop(self, 'tab_zero_to_menu') row.prop(self, 'tab_station_menu') row.prop(self, 'tab_interpolate_menu') row.prop(self, 'tab_mirror_menu') row.prop(self, 'tab_automirror_menu') row.prop(self, 'tab_tinycad_menu') row.prop(self, 'tab_looptools_menu') row.prop(self, 'tab_relax_menu') row.prop(self, 'tab_edger_menu') row.prop(self, 'tab_space_menu') row.prop(self, 'tab_machine_menu') box.separator() # KEYMAP # if self.prefs_tabs == 'keymap': box = layout.box().column(1) row = box.column(1) row.label("Align Menu:", icon ="COLLAPSEMENU") row.separator() row.label("Menu: [SHIFT+Y] ") row = box.row(1) row.prop(self, 'tab_menu_align', expand=True) if self.tab_menu_align == 'off': box.separator() row = box.row(1) row.label(text="! durably hidden with next reboot!", icon ="INFO") box.separator() # ORIGIN # box = layout.box().column(1) row = box.row(1) row.label("Origin Menu: [CTRL+D] ", icon ="COLLAPSEMENU") row.prop(self, 'tab_menu_view_origin', expand=True) if self.tab_menu_view_origin == 'off': box.separator() row = box.row(1) row.label(text="! durably hidden with next reboot!", icon ="INFO") else: box.separator() row = box.row(1) row.label(" ", icon ="BLANK1") row.prop(self, 'tab_origin_adv') box.separator() # RELAX # box = layout.box().column(1) row = box.row(1) row.label("Relax Menu: [CTRL+SHIFT+W] ", icon ="COLLAPSEMENU") row.prop(self, 'tab_menu_view_relax', expand=True) if self.tab_menu_view_relax == 'off': box.separator() row = box.row(1) row.label(text="! durably hidden with next reboot!", icon ="INFO") box.separator() # NORMALS # box = layout.box().column(1) row = box.row(1) row.label("Normal Translate Menu:", icon ="COLLAPSEMENU") row.prop(self, 'tab_menu_normal', expand=True) if self.tab_menu_normal == 'off': box.separator() row = box.row(1) row.label(text="! durably hidden with next reboot!", icon ="INFO") row = box.row(1) row.label("Toolshelf [T] > Tools > Transform") box.separator() meshmaschine_addon = "MESHmachine" state = addon_utils.check(meshmaschine_addon) if not state[0]: pass else: # MESHmachine # box = layout.box().column(1) row = box.row(1) row.label("MESHmachine Menu: [SHIFT+X] ", icon ="COLLAPSEMENU") row.prop(self, 'tab_menu_machine', expand=True) if self.tab_menu_machine == 'off': box.separator() row = box.row(1) row.label(text="! durably hidden with next reboot!", icon ="INFO") box.separator() row = box.row(1) row.label("Add to Special-Edit-Menu [W]") row.prop(self, 'tab_submenu_machine', expand=True) box.separator() box.separator() # TIP # row = layout.row(1) row.label(text="! For key change you can go also to > User Preferences > TAB: Input !", icon ="INFO") row = layout.column(1) row.label(text="1 > Change search to key-bindig and insert the hotkey, eg. key: shift y", icon ="BLANK1") row.label(text="2 > Under 3D View you find the call menu, name: VIEW3D_TP_Align_Menu !", icon ="BLANK1") row.label(text="3 > Choose a new key configuration and save user settings !", icon ="BLANK1") row.separator() row.label(text="(4) > Use the 'is key free' addon under User Interface to finde a free shortcut !", icon ="BLANK1") box.separator() row = layout.row(1) row.label(text="! Or edit the keymap script directly !", icon ="INFO") row.operator("tp_ops.keymap_align", text = 'Open KeyMap (Text Editor)') row.operator('wm.url_open', text = 'Type of Events (WEB)').url = "https://lh3.googleusercontent.com/zfNKbUKpnvLTPADu4btQI_adXhkR9iPiSyy31ZvP89YNK6YSiLf4iVC3lpzN76DTdEdHHIZqZK6qM2OYRSAeFRlIof5xHC0wLQtOaCwYEKi43A6W9KGkGAwnlNGqUugQdleEHTMLZnL67u4m6kU1KTKlFASfyDuFCCvdyGGaa5-gZ9kib1AiJ_2exgWvRh1yM86PehsJH65Zp0r6x5zhqZpLI1IS9K-zlyvaKg_WgYuVMzvsd3JrB2BAo-BIZGX9MFA8t-CC3qVtTLXH8WAkHo9IyA1u7GnlCM5p9wffwpu1NhCsZTuQwPnn0BGmOCD0tPCm_LJSJSDyCtkfBXvK_hdsQ3XM0Jcttl1oHJKYqbPoIjHMaLl7pNGmwMhcjlgPqXMq01Eln0wm6NHbJyTe5WMBN7FaB0WEaot7V9TsFxACRJzD2dJu-zP7xJ_vw6sMlYcXLf962SkzRShIMTJiBzSxui5sRJ1uKPCehcdP4E3pEc1tIFO1dQZTSwrLf9luz1S79zCflUCgJFWa8GfN4KGWG09mO4jUBJIdtobsDeM_NPyvraz6Lq4OTz90zgQQ1cxTzQ49MzYcIesnrw7TE2Ilr7UTkOpuoxL4rPw=w696-h1278-no" box.separator() # HEADER # if self.prefs_tabs == 'header': layout = self.layout box = layout.box().column(1) row = box.row(1) row.label("Functions to Header are removed as separated addon :", icon ="INFO") row.operator('wm.url_open', text = 'T+ Header').url = "https://github.com/mkbreuer/ToolPlus/2.79/Sets" # NP STATION # if self.prefs_tabs == 'view': layout = self.layout box = layout.box().column(1) row = box.column(1) row.label("NP Station Settings:", icon ="COLLAPSEMENU") row.label("ABC Point Align / GRS Snap Transform Tools", icon ="COLLAPSEMENU") split = box.split() col = split.column() col.label(text='Main color scheme:') col = split.column() col.prop(self, "np_col_scheme") split = box.split() col = split.column() col.label(text='Size of the numerics:') col = split.column() col.prop(self, "np_size_num") split = box.split() col = split.column() col.label(text='Unit scale for distance:') col = split.column() col.prop(self, "np_scale_dist") split = box.split() col = split.column() col.label(text='Unit suffix for distance:') col = split.column() col.prop(self, "np_suffix_dist") split = box.split() col = split.column() col.label(text='Mouse badge:') col = split.column() col = split.column() col.prop(self, "np_display_badge") if self.np_display_badge == True: col = split.column() col.prop(self, "np_size_badge") else: col = split.column() split = box.split() split = box.split() split = box.split() box = layout.box().column(1) row = box.column(1) row.label("Point Distance Settings:", icon ="COLLAPSEMENU") split = box.split() split = box.split() col = split.column() col.prop(self, "nppd_scale") col = split.column() col.prop(self, "nppd_suffix") split = box.split() col = split.column() col.prop(self, "nppd_step") col = split.column() col.prop(self, "nppd_badge") col = split.column() col.prop(self, "nppd_hold") col = split.column() col.prop(self, "nppd_gold") split = box.split() col = split.column() col = split.column() col.prop(self, "nppd_info") col = split.column() col.prop(self, "nppd_clip") split = box.split() col = split.column() col.label(text='Line Main COLOR') col.prop(self, "nppd_col_line_main_DEF") if self.nppd_col_line_main_DEF == False: col.prop(self, "nppd_col_line_main") col = split.column() col.label(text='Line Shadow COLOR') col.prop(self, "nppd_col_line_shadow_DEF") if self.nppd_col_line_shadow_DEF == False: col.prop(self, "nppd_col_line_shadow") col = split.column() col.label(text='Numerical Main COLOR') col.prop(self, "nppd_col_num_main_DEF") if self.nppd_col_num_main_DEF == False: col.prop(self, "nppd_col_num_main") col = split.column() col.label(text='Numerical Shadow COLOR') col.prop(self, "nppd_col_num_shadow_DEF") if self.nppd_col_num_shadow_DEF == False: col.prop(self, "nppd_col_num_shadow") split = box.split() col = split.column() col.prop(self, "nppd_stereo_cage") col = split.column() col.prop(self, "nppd_xyz_lines") col = split.column() col.prop(self, "nppd_xyz_distances") if self.nppd_xyz_distances == True: col = split.column() col.prop(self, "nppd_xyz_backdrop") else: col = split.column() # WEB # if self.prefs_tabs == 'url': row = layout.row() row.operator('wm.url_open', text = 'BlenderArtist', icon = 'BLENDER').url = "https://blenderartists.org/forum/showthread.php?409510-Addon-T-Align&p=3114519#post3114519" row.operator('wm.url_open', text = 'GitHub', icon = 'BLENDER').url = "https://github.com/mkbreuer/ToolPlus"
def draw(self, context): layout = self.layout icons = load_icons() layout.operator_context = 'INVOKE_REGION_WIN' layout.menu("VIEW3D_TP_Pivot_Menu", text="Pivot", icon="CURSOR") button_snap_cursor = icons.get("icon_snap_cursor") layout.menu("VIEW3D_TP_SnapSet_Menu", text="SnapSet", icon_value=button_snap_cursor.icon_id) layout.separator() layout.menu("VIEW3D_TP_Origin_Menu", text="Origin", icon="LAYER_ACTIVE") layout.separator() if context.mode == 'OBJECT': layout.menu("VIEW3D_TP_Location_Menu", text="Move", icon ="MAN_TRANS") layout.menu("VIEW3D_TP_Rotation_Menu", text="Rotate", icon ="MAN_ROT") layout.menu("VIEW3D_TP_Scale_Menu", text="Scale", icon ="MAN_SCALE") else: layout.menu("VIEW3D_TP_Axis_Menu", text="To Axis", icon ="MANIPUL") layout.separator() button_origin_align = icons.get("icon_origin_align") layout.menu("VIEW3D_TP_Tools_Menu", text="Tools", icon_value=button_origin_align.icon_id) if context.mode == 'OBJECT': button_snap_grab = icons.get("icon_snap_grab") layout.menu("VIEW3D_TP_Station_Menu", text="NPoint", icon_value=button_snap_grab.icon_id) obj = context.active_object if obj: obj_type = obj.type if obj_type in {'MESH'}: layout.separator() layout.operator("mesh.wplsmthdef_snap", text="Save M-State", icon ="SHAPEKEY_DATA") if context.mode == 'EDIT_MESH': layout.separator() layout.operator("mesh.wplsmthdef_apply", text="Apply S-Deform", icon ="FRAME_NEXT") layout.separator() button_align_straigten = icons.get("icon_align_straigten") layout.menu("VIEW3D_TP_Align_Menu_Space", text="Space", icon_value=button_align_straigten.icon_id) Display_Looptools = context.user_preferences.addons[__package__].preferences.tab_looptools if Display_Looptools == 'on': loop_tools_addon = "mesh_looptools" state = addon_utils.check(loop_tools_addon) if not state[0]: layout.operator("tp_ops.enable_looptools", text="!_Activate Looptools_!", icon='BLANK1') else: layout.menu("VIEW3D_TP_Align_Menu_Gstretch", text="GStretch", icon="GREASEPENCIL") layout.separator() button_align_circle = icons.get("icon_align_circle") layout.menu("VIEW3D_TP_Align_Menu_LoopTools", text="LoopTools", icon_value=button_align_circle.icon_id) Display_Relax = context.user_preferences.addons[__package__].preferences.tab_relax if Display_Relax == 'on': button_align_shrinkwrap = icons.get("icon_align_shrinkwrap") layout.menu("VIEW3D_TP_Align_Menu_Relax", text="Smooth Relax", icon_value=button_align_shrinkwrap.icon_id) layout.separator() button_align_mirror_obm = icons.get("icon_align_mirror_obm") layout.menu("VIEW3D_TP_Mirror_Menu", text="Mirror", icon_value=button_align_mirror_obm.icon_id) layout.menu("VIEW3D_TP_ModMirror_Menu", text="Mirror", icon="MOD_MIRROR") layout.separator() button_align_zero = icons.get("icon_align_zero") layout.operator("tp_ops.zero_axis", "ZeroAxis", icon_value=button_align_zero.icon_id)
def dump_addon_messages(module_name, do_checks, settings): import addon_utils # Get current addon state (loaded or not): was_loaded = addon_utils.check(module_name)[1] # Enable our addon. addon = utils.enable_addons(addons={module_name})[0] addon_info = addon_utils.module_bl_info(addon) ver = addon_info["name"] + " " + ".".join(str(v) for v in addon_info["version"]) rev = 0 date = datetime.datetime.now() pot = utils.I18nMessages.gen_empty_messages(settings.PARSER_TEMPLATE_ID, ver, rev, date, date.year, settings=settings) msgs = pot.msgs minus_pot = utils.I18nMessages.gen_empty_messages(settings.PARSER_TEMPLATE_ID, ver, rev, date, date.year, settings=settings) minus_msgs = minus_pot.msgs check_ctxt = _gen_check_ctxt(settings) if do_checks else None minus_check_ctxt = _gen_check_ctxt(settings) if do_checks else None # Get strings from RNA, our addon being enabled. print("A") reports = _gen_reports(check_ctxt) print("B") dump_rna_messages(msgs, reports, settings) print("C") # Now disable our addon, and rescan RNA. utils.enable_addons(addons={module_name}, disable=True) print("D") reports["check_ctxt"] = minus_check_ctxt print("E") dump_rna_messages(minus_msgs, reports, settings) print("F") # Restore previous state if needed! if was_loaded: utils.enable_addons(addons={module_name}) # and make the diff! for key in minus_msgs: if key != settings.PO_HEADER_KEY: del msgs[key] if check_ctxt: _diff_check_ctxt(check_ctxt, minus_check_ctxt) # and we are done with those! del minus_pot del minus_msgs del minus_check_ctxt # get strings from UI layout definitions text="..." args reports["check_ctxt"] = check_ctxt dump_py_messages(msgs, reports, {addon}, settings, addons_only=True) pot.unescape() # Strings gathered in py/C source code may contain escaped chars... print_info(reports, pot) print("Finished extracting UI messages!") return pot
def addon_ensure(addon_id): # Enable the addon, dont change preferences. default_state, loaded_state = addon_utils.check(addon_id) if not loaded_state: addon_utils.enable(addon_id, default_set=False)
def poll(cls, blender_context): loaded_default, loaded_state = check("io_scene_ms3d") return loaded_state
def draw(self, context): layout = self.layout layout.operator_context = 'INVOKE_REGION_WIN' icons = load_icons() pie = layout.menu_pie() addon_key = __package__.split(".")[0] panel_prefs = context.user_preferences.addons[addon_key].preferences expand = panel_prefs.expand_panel_tools #B1 ########### 1_Left ------------------------------------------------ box = pie.split().box().column(1) if context.mode =="OBJECT": row = box.row(1) button_origin_center_view = icons.get("icon_origin_center_view") row.operator("tp_ops.origin_set_center", text=" ", icon_value=button_origin_center_view.icon_id) button_origin_cursor = icons.get("icon_origin_cursor") row.operator("tp_ops.origin_set_cursor", text=" ", icon_value=button_origin_cursor.icon_id) button_origin_mass = icons.get("icon_origin_mass") row.operator("tp_ops.origin_set_mass", text=" ", icon_value=button_origin_mass.icon_id) row = box.row(1) if len(bpy.context.selected_objects) == 1: if context.mode == 'OBJECT': button_origin_bbox = icons.get("icon_origin_bbox") row.operator("tp_ops.bbox_origin_modal_ops", text=" ", icon_value=button_origin_bbox.icon_id) else: obj = context.active_object if obj: obj_type = obj.type if obj.type in {'MESH'}: button_origin_bbox = icons.get("icon_origin_bbox") row.operator("tp_ops.bbox_origin_set"," ", icon_value=button_origin_bbox.icon_id) else: button_origin_bbox = icons.get("icon_origin_bbox") row.operator("tp_ops.bbox_origin_modal_ops", text=" ", icon_value=button_origin_bbox.icon_id) button_origin_tomesh = icons.get("icon_origin_tomesh") row.operator("tp_ops.origin_tomesh", text=" ", icon_value=button_origin_tomesh.icon_id) button_origin_meshto = icons.get("icon_origin_meshto") row.operator("tp_ops.origin_meshto", text=" ", icon_value=button_origin_meshto.icon_id) else: row = box.row(1) button_origin_center_view = icons.get("icon_origin_center_view") row.operator("tp_ops.origin_set_center", text=" ", icon_value=button_origin_center_view.icon_id) button_origin_cursor = icons.get("icon_origin_cursor") row.operator("tp_ops.origin_cursor_edm", text=" ", icon_value=button_origin_cursor.icon_id) row = box.row(1) button_origin_bbox = icons.get("icon_origin_bbox") row.operator("tp_ops.bbox_origin_set"," ", icon_value=button_origin_bbox.icon_id) button_origin_obj = icons.get("icon_origin_obj") row.operator("tp_ops.origin_obm"," ", icon_value=button_origin_obj.icon_id) button_origin_edm = icons.get("icon_origin_edm") row.operator("tp_ops.origin_edm"," ", icon_value=button_origin_edm.icon_id) #B2 ########### 2_Right ------------------------------------------------ box = pie.split().box().column(1) box.scale_x = 0.85 if not context.space_data.current_orientation: row = box.row(1) row.label("Transform Orientation") row = box.row(1) row.prop(context.space_data, "transform_orientation", text="", icon='MANIPUL') row.operator("transform.create_orientation", text="", icon='ZOOMIN') if context.space_data.current_orientation: row = box.row(1) row.prop(context.space_data.current_orientation, "name", text="") row.operator("transform.delete_orientation", text="", icon='X') #B3 ########### 3_Bottom ------------------------------------------------ box = pie.split().box().column(1) if context.mode =="OBJECT": box.scale_x = 0.9 row = box.row(1) props = row.operator("tp_ops.align_transform",text="Rotate", icon='MAN_ROT') props.tp_axis= 'axis_xyz' props.tp_transform= 'ROTATION' row.operator("object.rotation_clear", text="", icon="PANEL_CLOSE") button_align_baply = icons.get("icon_align_baply") props = row.operator("object.transform_apply", text="", icon_value=button_align_baply.icon_id) props.location= False props.rotation= True props.scale= False box.separator() row = box.row(1) button_align_x = icons.get("icon_align_x") props = row.operator("tp_ops.align_transform", "X", icon_value=button_align_x.icon_id) props.tp_axis= 'axis_x' props.tp_transform= 'ROTATION' button_align_y = icons.get("icon_align_y") props = row.operator("tp_ops.align_transform", "Y", icon_value=button_align_y.icon_id) props.tp_axis= 'axis_y' props.tp_transform= 'ROTATION' button_align_z = icons.get("icon_align_z") props = row.operator("tp_ops.align_transform", "Z", icon_value=button_align_z.icon_id) props.tp_axis= 'axis_z' props.tp_transform= 'ROTATION' row = box.row(1) button_align_xy = icons.get("icon_align_xy") props = row.operator("tp_ops.align_transform", "Xy", icon_value=button_align_xy.icon_id) props.tp_axis= 'axis_xy' props.tp_transform= 'ROTATION' button_align_zx = icons.get("icon_align_zx") props = row.operator("tp_ops.align_transform", "Zx", icon_value=button_align_zx.icon_id) props.tp_axis= 'axis_zx' props.tp_transform= 'ROTATION' button_align_zy = icons.get("icon_align_zy") props = row.operator("tp_ops.align_transform", "Zy", icon_value=button_align_zy.icon_id) props.tp_axis= 'axis_zy' props.tp_transform= 'ROTATION' else: if bpy.context.mode == "EDIT_MESH": row = box.row(1) button_align_straigten = icons.get("icon_align_straigten") row.operator("mesh.vertex_align",text=" ", icon_value=button_align_straigten.icon_id) button_align_distribute = icons.get("icon_align_distribute") row.operator("mesh.vertex_distribute",text=" ", icon_value=button_align_distribute.icon_id) button_align_unbevel = icons.get("icon_align_unbevel") row.operator("tp_ops.unbevel", text=" ", icon_value=button_align_unbevel.icon_id) imdjs_tools_addon = "IMDJS_mesh_tools" state = addon_utils.check(imdjs_tools_addon) if not state[0]: button_align_radians = icons.get("icon_align_radians") row.operator("mesh.round_selected_points", text="Radians", icon_value=button_align_radians.icon_id) row = box.row(1) row.operator("mesh.wplsmthdef_apply", text="Deform", icon ="FRAME_NEXT") button_lattice_add = icons.get("icon_lattice_add") row.operator("tp_ops.easy_lattice", "E-Lattice", icon_value=button_lattice_add.icon_id) Display_Looptools = context.user_preferences.addons[addon_key].preferences.tab_looptools if Display_Looptools == True: loop_tools_addon = "mesh_looptools" state = addon_utils.check(loop_tools_addon) if not state[0]: row = box.row(1) row.operator("tp_ops.enable_looptools", text="!_Activate Looptools_!") else: row = box.row(1) button_align_space = icons.get("icon_align_space") row.operator("mesh.looptools_space", text=" ", icon_value=button_align_space.icon_id) button_align_curve = icons.get("icon_align_curve") row.operator("mesh.looptools_curve", text=" ", icon_value=button_align_curve.icon_id) button_align_circle = icons.get("icon_align_circle") row.operator("mesh.looptools_circle", text=" ", icon_value=button_align_circle.icon_id) button_align_flatten = icons.get("icon_align_flatten") row.operator("mesh.looptools_flatten", text=" ", icon_value=button_align_flatten.icon_id) Display_Relax = context.user_preferences.addons[addon_key].preferences.tab_relax if Display_Relax == True: row = box.row(1) button_align_vertices = icons.get("icon_align_vertices") row.operator("mesh.vertices_smooth"," ", icon_value=button_align_vertices.icon_id) button_align_laplacian = icons.get("icon_align_laplacian") row.operator("mesh.vertices_smooth_laplacian"," ", icon_value=button_align_laplacian.icon_id) button_align_shrinkwrap = icons.get("icon_align_shrinkwrap") row.operator("mesh.shrinkwrap_smooth"," ", icon_value=button_align_shrinkwrap.icon_id) Display_Looptools = context.user_preferences.addons[addon_key].preferences.tab_looptools if Display_Looptools == True: loop_tools_addon = "mesh_looptools" state = addon_utils.check(loop_tools_addon) if not state[0]: pass else: button_align_looptools = icons.get("icon_align_looptools") row.operator("mesh.looptools_relax", text=" ", icon_value=button_align_looptools.icon_id) box.separator() row = box.row(1) row.operator("tp_ops.surface_pencil", text=" ",icon="GREASEPENCIL") sub = row.row(1) sub.scale_x = 1 sub.operator("mesh.looptools_gstretch", text="Gstretch", icon='IPO_EASE_IN_OUT') row.operator("remove.gp", text=" ", icon="PANEL_CLOSE") else: if context.mode =="EDIT_CURVE": box.scale_x = 0.9 row = box.row(1) row.operator("curve.handle_type_set", text="Auto").type = 'AUTOMATIC' row.operator("curve.handle_type_set", text="Vector").type = 'VECTOR' row.operator("curve.handle_type_set", text="Align").type = 'ALIGNED' row = box.row(1) row.operator("curve.switch_direction", text="Route") row.operator("curve.cyclic_toggle", text="Cyclic") row.operator("curve.handle_type_set", text="Free").type = 'FREE_ALIGN' else: pass #B4 ########### 4_Top ------------------------------------------------ box = pie.split().box().column() box.scale_x = 1 row = box.row(1) row.operator("tp_ops.pivot_bounding_box", " ", icon="ROTATE", emboss=False) row.operator("tp_ops.pivot_3d_cursor", " ", icon="CURSOR", emboss=False) button_snap_cursor = icons.get("icon_snap_cursor") row.menu("VIEW3D_TP_SnapSet_Menu", text=" ", icon_value=button_snap_cursor.icon_id) row = box.row(1) row.operator("tp_ops.pivot_active", " ", icon="ROTACTIVE", emboss=False) row.operator("tp_ops.pivot_individual", " ", icon="ROTATECOLLECTION", emboss=False) row.operator("tp_ops.pivot_median", " ", icon="ROTATECENTER", emboss=False) #B5 ########### 5_Top_Left ------------------------------------------------ box = pie.split().box().column(1) box.scale_x = 0.95 if context.mode =="OBJECT": row = box.row(1) obj = context.active_object if obj: obj_type = obj.type if obj.type in {'MESH'}: row = box.row(1) button_snap_face_to_face = icons.get("icon_snap_face_to_face") row.operator("object.align_by_faces", text=" ", icon_value=button_snap_face_to_face.icon_id) button_snap_drop_down = icons.get("icon_snap_drop_down") row.operator("object.drop_on_active", text=" ", icon_value=button_snap_drop_down.icon_id) button_lattice_apply = icons.get("icon_lattice_apply") row.operator("tp_ops.lattice_apply", " ", icon_value=button_lattice_apply.icon_id) row.operator("mesh.wplsmthdef_snap", text=" ", icon ="SHAPEKEY_DATA") row = box.row(1) button_snap_offset = icons.get("icon_snap_offset") row.operator("view3d.xoffsets_main", " ", icon_value=button_snap_offset.icon_id) row.operator("tp_ops.xy_spread", text=" ", icon="AXIS_TOP") else: button_align_advance = icons.get("icon_align_advance") row.operator("tp_origin.align_tools", " ", icon_value=button_align_advance.icon_id) button_origin_distribute = icons.get("icon_origin_distribute") row.operator("tp_ops.distribute_objects_menu", " ", icon_value=button_origin_distribute.icon_id) button_align_zero = icons.get("icon_align_zero") row.operator("tp_ops.zero_axis", " ", icon_value=button_align_zero.icon_id) else: box.scale_x = 1.4 row = box.row(1) if context.mode =="EDIT_MESH": button_align_planar = icons.get("icon_align_planar") row.operator("mesh.face_make_planar", " ", icon_value=button_align_planar.icon_id) button_snap_offset = icons.get("icon_snap_offset") row.operator("view3d.xoffsets_main", " ", icon_value=button_snap_offset.icon_id) row = box.row(1) button_align_con_face = icons.get("icon_align_con_face") row.operator("mesh.rot_con", " ", icon_value=button_align_con_face.icon_id) button_align_zero = icons.get("icon_align_zero") row.operator("tp_ops.zero_axis", " ", icon_value=button_align_zero.icon_id) #B6 ########### 6_Top_Right ------------------------------------------------ box = pie.split().box().column(1) box.scale_x = 0.95 if context.mode =="OBJECT": obj = context.active_object if obj: obj_type = obj.type if obj.type in {'MESH'}: row = box.row(1) button_snap_grab = icons.get("icon_snap_grab") row.operator("tp_ops.np_020_point_move", text='G', icon_value=button_snap_grab.icon_id) button_snap_rotate = icons.get("icon_snap_rotate") row.operator("tp_ops.np_020_roto_move", text='R', icon_value=button_snap_rotate.icon_id) button_snap_scale = icons.get("icon_snap_scale") row.operator("tp_ops.np_020_point_scale", text='S', icon_value=button_snap_scale.icon_id) button_snap_abc = icons.get("icon_snap_abc") row.operator("tp_ops.np_020_point_align", text='A', icon_value=button_snap_abc.icon_id) if context.mode =="EDIT_MESH": row = box.row(1) button_align_mirror_edge = icons.get("icon_align_mirror_edge") row.operator("tp_ops.mirror_over_edge", "Mirror over Edge", icon_value=button_align_mirror_edge.icon_id) row = box.row(1) row.operator("tp_ops.mirror1",text="X", icon='ARROW_LEFTRIGHT') row.operator("tp_ops.mirror2",text="Y", icon='ARROW_LEFTRIGHT') row.operator("tp_ops.mirror3",text="Z", icon='ARROW_LEFTRIGHT') button_align_advance = icons.get("icon_align_advance") row.operator("tp_origin.align_tools", " ", icon_value=button_align_advance.icon_id) #B7 ########### 7_Bottom_Left ------------------------------------------------ box = pie.split().box().column(1) box.scale_x = 0.9 if context.mode == "OBJECT": row = box.row(1) props = row.operator("tp_ops.align_transform",text="Scale", icon='MAN_SCALE') props.tp_axis= 'axis_xyz' props.tp_transform= 'SCALE' row.operator("object.scale_clear", text="", icon="PANEL_CLOSE") button_align_baply = icons.get("icon_align_baply") props = row.operator("object.transform_apply", text="", icon_value=button_align_baply.icon_id) props.location= False props.rotation= False props.scale= True box.separator() row = box.row(1) button_align_x = icons.get("icon_align_x") props = row.operator("tp_ops.align_transform", "X", icon_value=button_align_x.icon_id) props.tp_axis= 'axis_x' props.tp_transform= 'SCALE' button_align_y = icons.get("icon_align_y") props = row.operator("tp_ops.align_transform", "Y", icon_value=button_align_y.icon_id) props.tp_axis= 'axis_y' props.tp_transform= 'SCALE' button_align_z = icons.get("icon_align_z") props = row.operator("tp_ops.align_transform", "Z", icon_value=button_align_z.icon_id) props.tp_axis= 'axis_z' props.tp_transform= 'SCALE' row = box.row(1) button_align_xy = icons.get("icon_align_xy") props = row.operator("tp_ops.align_transform", "Xy", icon_value=button_align_xy.icon_id) props.tp_axis= 'axis_xy' props.tp_transform= 'SCALE' button_align_zx = icons.get("icon_align_zx") props = row.operator("tp_ops.align_transform", "Zx", icon_value=button_align_zx.icon_id) props.tp_axis= 'axis_zx' props.tp_transform= 'SCALE' button_align_zy = icons.get("icon_align_zy") props = row.operator("tp_ops.align_transform", "Zy", icon_value=button_align_zy.icon_id) props.tp_axis= 'axis_zy' props.tp_transform= 'SCALE' if context.mode =="EDIT_MESH": row = box.row(1) row.operator("mesh.align_operator", text = 'Store Edge').type_op = 1 align_op = row.operator("mesh.align_operator", text = 'Align Edges').type_op = 0 row = box.row(1) row.prop(bpy.context.window_manager.paul_manager, 'align_dist_z', text = 'dist Z') row.prop(bpy.context.window_manager.paul_manager, 'align_lock_z', text = 'lock Z') if context.mode =="EDIT_CURVE": box.scale_x = 0.725 row = box.row(1) row.operator("curve.spline_type_set", text="CvType") row.operator("curve.normals_make_consistent", text="Recalc") row.operator("curve.smooth", text="Smooth") row = box.row(1) row.operator("transform.transform", text="Shrink").mode = 'CURVE_SHRINKFATTEN' row.operator("curve.radius_set", text="Radius") row.operator("transform.tilt", text="Tilt") #B8 ########### 8_Bottom_Right_Objectmode ------------------------------------------------ box = pie.split().box().column(1) box.scale_x = 0.9 if context.mode =="OBJECT": row = box.row(1) props = row.operator("tp_ops.align_transform", text="Move", icon='MAN_TRANS') props.tp_axis= 'axis_xyz' props.tp_transform= 'LOCATION' row.operator("object.location_clear", text="", icon="PANEL_CLOSE") button_align_baply = icons.get("icon_align_baply") props = row.operator("object.transform_apply", text="", icon_value=button_align_baply.icon_id) props.location= True props.rotation= False props.scale= False box.separator() row = box.row(1) button_align_x = icons.get("icon_align_x") props = row.operator("tp_ops.align_transform", "X", icon_value=button_align_x.icon_id) props.tp_axis= 'axis_x' props.tp_transform= 'LOCATION' button_align_y = icons.get("icon_align_y") props = row.operator("tp_ops.align_transform", "Y", icon_value=button_align_y.icon_id) props.tp_axis= 'axis_y' props.tp_transform= 'LOCATION' button_align_z = icons.get("icon_align_z") props = row.operator("tp_ops.align_transform", "Z", icon_value=button_align_z.icon_id) props.tp_axis= 'axis_z' props.tp_transform= 'LOCATION' row = box.row(1) button_align_xy = icons.get("icon_align_xy") props = row.operator("tp_ops.align_transform", "Xy", icon_value=button_align_xy.icon_id) props.tp_axis= 'axis_xy' props.tp_transform= 'LOCATION' button_align_zx = icons.get("icon_align_zx") props = row.operator("tp_ops.align_transform", "Zx", icon_value=button_align_zx.icon_id) props.tp_axis= 'axis_zx' props.tp_transform= 'LOCATION' button_align_zy = icons.get("icon_align_zy") props = row.operator("tp_ops.align_transform", "Zy", icon_value=button_align_zy.icon_id) props.tp_axis= 'axis_zy' props.tp_transform= 'LOCATION' else: row = box.row(1) button_align_x = icons.get("icon_align_x") row.operator("tp_ops.align_transform", "X", icon_value=button_align_x.icon_id).tp_axis='axis_x' button_align_y = icons.get("icon_align_y") row.operator("tp_ops.align_transform",text="Y", icon_value=button_align_y.icon_id).tp_axis='axis_y' button_align_z = icons.get("icon_align_z") row.operator("tp_ops.align_transform",text="Z", icon_value=button_align_z.icon_id).tp_axis='axis_z' row = box.row(1) button_align_xy = icons.get("icon_align_xy") row.operator("tp_ops.align_transform", "Xy", icon_value=button_align_xy.icon_id).tp_axis='axis_xy' button_align_zy = icons.get("icon_align_zy") row.operator("tp_ops.align_transform", "Zy", icon_value=button_align_zy.icon_id).tp_axis='axis_zy' button_align_zx = icons.get("icon_align_zx") row.operator("tp_ops.align_transform", "Zx", icon_value=button_align_zx.icon_id).tp_axis='axis_zx'
def draw(self, context): addon_state_pr = addon_utils.check("proxy_refresh") # Panel requires 'proxy_refresh' add-on addon_state_acas = addon_utils.check("addon_create_animation_scene") # Panel requires 'addon_create_animation_scene' add-on layout = self.layout col = layout.column(align = False) col.label("Local Scene") box = col.box() row = box.row(align = True) if addon_state_pr: row.label(icon = 'OUTLINER_OB_ARMATURE') row.operator("object.proxy_refresh", text = "Refresh Proxy", icon = 'FILE_REFRESH') else: row.label(text = "Add-on Failed to Load", icon = 'CANCEL') row = box.row(align = True) row.label(text = " [Tangent: Proxy Refresh Tool]") row = box.row(align = True) row = box.row(align = True) subcol = row.column(align = True) subrow = subcol.row(align = True) split = subrow.split(percentage = 0.3, align = True) if context.scene.asset_resolution == 'HIGH': split.prop_menu_enum(context.scene, "asset_resolution", text = context.scene.asset_resolution, icon = 'SOLID') elif context.scene.asset_resolution == 'MID': split.prop_menu_enum(context.scene, "asset_resolution", text = context.scene.asset_resolution, icon = 'ANTIALIASED') elif context.scene.asset_resolution == 'LOW': split.prop_menu_enum(context.scene, "asset_resolution", text = context.scene.asset_resolution, icon = 'ALIASED') split = subrow.split(percentage = 1, align = True) split.operator("object.change_asset_resolution", text = "Change Resolution", icon = 'FILE_REFRESH') subrow = subcol.row(align = True) subrow.label(text = "Resolution Swap will NOT work if", icon = 'ERROR') subrow = subcol.row(align = True) subrow.label(text = " the linked groups have orphan data") col.separator() col.separator() row = col.row() row.label(text = "New Scene", icon = 'SCENE_DATA') box = col.box() row = box.row(align = True) if addon_state_acas: subrow = box.row(align = True) subcol = row.column(align = True) subrow = subcol.row(align = True) split = subrow.split(percentage = 0.3, align = True) if context.scene.scene_resolution == 'HIGH': split.prop_menu_enum(context.scene, "scene_resolution", text = context.scene.scene_resolution, icon = 'SOLID') elif context.scene.scene_resolution == 'MID': split.prop_menu_enum(context.scene, "scene_resolution", text = context.scene.scene_resolution, icon = 'ANTIALIASED') elif context.scene.scene_resolution == 'LOW': split.prop_menu_enum(context.scene, "scene_resolution", text = context.scene.scene_resolution, icon = 'ALIASED') split = subrow.split(percentage = 1, align = True) split.operator("object.create_scene_resolution", text = "Create Scene", icon = 'FILE_REFRESH') subrow = subcol.row(align = True) subrow.label(text = "Objects with missing resolution are", icon = 'INFO') subrow = subcol.row(align = True) subrow.label(text = " linked at their current resolution") else: row.label(text = "Add-on Failed to Load", icon = 'CANCEL') row = box.row(align = True) row.label(text = " [Tangent: Create Temporary Animation Scene]")
def is_addon_enabled(addon_name): return addon_utils.check(addon_name)[1]
def draw_history_tools(context, layout): icons = load_icons() scene = context.scene tp_props = context.window_manager.tp_collapse_align layout.operator_context = 'INVOKE_REGION_WIN' col = layout.column(align=True) box = col.box().column(1) row = box.row(1) if tp_props.display_align_options: row.prop(tp_props, "display_align_options", text="", icon="SCRIPTWIN") else: row.prop(tp_props, "display_align_options", text="", icon="SCRIPTWIN") button_ruler_triangle = icons.get("icon_ruler_triangle") row.operator("view3d.ruler", text="Ruler", icon_value=button_ruler_triangle.icon_id) row.operator("ed.undo", text="", icon="FRAME_PREV") row.operator("ed.undo_history", text="", icon="COLLAPSEMENU") row.operator("ed.redo", text="", icon="FRAME_NEXT") if tp_props.display_align_options: addon_key = __package__.split(".")[0] panel_prefs = context.user_preferences.addons[addon_key].preferences box.separator() row = box.row(1) row.prop(scene, 'tp_align', expand = True) if scene.tp_align == "tp_01": box.separator() row = box.column(1) row.label("Panel Location") row = box.column(1) row.prop(panel_prefs, 'tab_location_align', expand=True) box.separator() row = box.row(1) row.prop(panel_prefs, "tools_category_align") box.separator() row = box.row(1) row.label("Panel Tools") row = box.column_flow(2) row.prop(panel_prefs, 'tab_origin') row.prop(panel_prefs, 'tab_align_to') row.prop(panel_prefs, 'tab_aligner') if context.mode =='OBJECT': row.prop(panel_prefs, 'tab_zero_to') row.prop(panel_prefs, 'tab_station') row.prop(panel_prefs, 'tab_interpolate') row.prop(panel_prefs, 'tab_mirror') row.prop(panel_prefs, 'tab_automirror') if context.mode =='EDIT_MESH': row.prop(panel_prefs, 'tab_looptools') row.prop(panel_prefs, 'tab_relax') row.prop(panel_prefs, 'tab_edger') row.prop(panel_prefs, 'tab_vertices') row.prop(panel_prefs, 'tab_machine') box.separator() if scene.tp_align == "tp_02": box.separator() row = box.row(1) row.label("Menu Tools") row = box.column_flow(2) row.prop(panel_prefs, 'tab_pivot_menu') row.prop(panel_prefs, 'tab_origin_menu') row.prop(panel_prefs, 'tab_align_to_menu') row.prop(panel_prefs, 'tab_aligner_menu') if context.mode =='OBJECT': row.prop(panel_prefs, 'tab_zero_to_menu') row.prop(panel_prefs, 'tab_station_menu') row.prop(panel_prefs, 'tab_interpolate_menu') row.prop(panel_prefs, 'tab_mirror_menu') row.prop(panel_prefs, 'tab_automirror_menu') if context.mode =='EDIT_MESH': row.prop(panel_prefs, 'tab_tinycad_menu') row.prop(panel_prefs, 'tab_looptools_menu') row.prop(panel_prefs, 'tab_relax_menu') row.prop(panel_prefs, 'tab_edger_menu') row.prop(panel_prefs, 'tab_space_menu') row.prop(panel_prefs, 'tab_machine_menu') box.separator() if scene.tp_align == "tp_03": box.separator() row = box.row(1) row.label("Align Menu [SHIFT+Y]") row = box.row(1) row.prop(panel_prefs, 'tab_menu_align', expand=True) box.separator() box.separator() row = box.row(1) row.label("Origin Menu [CTRL+D]") row = box.row(1) row.prop(panel_prefs, 'tab_menu_view_origin', expand=True) row = box.row(1) row.prop(panel_prefs, 'tab_origin_adv') box.separator() box.separator() row = box.row(1) row.label("Relax Menu [CTRL+SHIFT+W]") row = box.row(1) row.prop(panel_prefs, 'tab_menu_view_relax', expand=True) box.separator() meshmaschine_addon = "MESHmachine" state = addon_utils.check(meshmaschine_addon) if not state[0]: pass else: box.separator() row = box.row(1) row.label("MESHmachine [SHIFT+X]") row = box.row(1) row.prop(panel_prefs, 'tab_menu_machine', expand=True) row = box.row(1) row.label("to special [W]") row = box.row(1) row.prop(panel_prefs, 'tab_submenu_machine', expand=True) box.separator() box.separator() row = box.row(1) wm = context.window_manager row.operator("wm.save_userpref", icon='FILE_TICK') box.separator()
def draw_spacing_ui(self, context, layout): tp = context.window_manager.tp_props_looptools tp_props = context.window_manager.tp_props_resurface icons = load_icons() col = layout.column(align=True) if not tp_props.display_spacing: box = col.box().column(1) row = box.row(1) row.prop(tp_props, "display_spacing", text="", icon="TRIA_RIGHT", emboss = False) row.label("Spacing") button_align_space = icons.get("icon_align_space") row.operator("mesh.tp_looptools_space", text="", icon_value=button_align_space.icon_id) button_align_distribute = icons.get("icon_align_distribute") row.operator("mesh.vertex_distribute",text="", icon_value=button_align_distribute.icon_id) button_align_straigten = icons.get("icon_align_straigten") row.operator("mesh.vertex_align",text="", icon_value=button_align_straigten.icon_id) else: box = col.box().column(1) row = box.row(1) row.prop(tp_props, "display_spacing", text="", icon="TRIA_DOWN", emboss = False) row.label("Spacing") button_align_space = icons.get("icon_align_space") row.operator("mesh.tp_looptools_space", text="", icon_value=button_align_space.icon_id) button_align_distribute = icons.get("icon_align_distribute") row.operator("mesh.vertex_distribute",text="", icon_value=button_align_distribute.icon_id) button_align_straigten = icons.get("icon_align_straigten") row.operator("mesh.vertex_align",text="", icon_value=button_align_straigten.icon_id) box = col.box().column(1) row = box.column(1) row.operator("mesh.hd_viewport_vertex_align") box.separator() row = box.column(1) button_align_straigten = icons.get("icon_align_straigten") row.operator("mesh.vertex_align",text="Straighten", icon_value=button_align_straigten.icon_id) button_align_distribute = icons.get("icon_align_distribute") row.operator("mesh.vertex_distribute",text="Distribute", icon_value=button_align_distribute.icon_id) imdjs_tools_addon = "IMDJS_mesh_tools" state = addon_utils.check(imdjs_tools_addon) if not state[0]: pass else: button_align_radians = icons.get("icon_align_radians") row.operator("mesh.round_selected_points", text="Radians") box.separator() row = box.row(1) # space - first line split = row.split(percentage=0.15, align=True) button_align_space = icons.get("icon_align_space") if tp.display_space: split.prop(tp, "display_space", text="", icon_value=button_align_space.icon_id) else: split.prop(tp, "display_space", text="", icon_value=button_align_space.icon_id) split.operator("mesh.tp_looptools_space", text="LoopTools Space", icon='BLANK1') # space - settings if tp.display_space: box = col.box().column(1) row = box.column(1) row.prop(tp, "space_interpolation") row.prop(tp, "space_input") box.separator() col_move = box.column(align=True) row = col_move.row(align=True) if tp.space_lock_x: row.prop(tp, "space_lock_x", text = "X", icon='LOCKED') else: row.prop(tp, "space_lock_x", text = "X", icon='UNLOCKED') if tp.space_lock_y: row.prop(tp, "space_lock_y", text = "Y", icon='LOCKED') else: row.prop(tp, "space_lock_y", text = "Y", icon='UNLOCKED') if tp.space_lock_z: row.prop(tp, "space_lock_z", text = "Z", icon='LOCKED') else: row.prop(tp, "space_lock_z", text = "Z", icon='UNLOCKED') col_move.prop(tp, "space_influence") box.separator() box = layout.box().column(1) row = box.row(1) # curve - first line split = row.split(percentage=0.15, align=True) button_align_curve = icons.get("icon_align_curve") if tp.display_curve: split.prop(tp, "display_curve", text="", icon_value=button_align_curve.icon_id) else: split.prop(tp, "display_curve", text="", icon_value=button_align_curve.icon_id) split.operator("mesh.tp_looptools_curve", text="LoopTools Curve", icon='BLANK1') # curve - settings if tp.display_curve: box = col.box().column(1) row = box.column(1) row.prop(tp, "curve_interpolation") row.prop(tp, "curve_restriction") row.prop(tp, "curve_boundaries") row.prop(tp, "curve_regular") box.separator() col_move = box.column(align=True) row = col_move.row(align=True) if tp.curve_lock_x: row.prop(tp, "curve_lock_x", text = "X", icon='LOCKED') else: row.prop(tp, "curve_lock_x", text = "X", icon='UNLOCKED') if tp.curve_lock_y: row.prop(tp, "curve_lock_y", text = "Y", icon='LOCKED') else: row.prop(tp, "curve_lock_y", text = "Y", icon='UNLOCKED') if tp.curve_lock_z: row.prop(tp, "curve_lock_z", text = "Z", icon='LOCKED') else: row.prop(tp, "curve_lock_z", text = "Z", icon='UNLOCKED') col_move.prop(tp, "curve_influence") box.separator() box = layout.box().column(1) row = box.row(1) # circle - first line split = row.split(percentage=0.15, align=True) button_align_circle = icons.get("icon_align_circle") if tp.display_circle: split.prop(tp, "display_circle", text="", icon_value=button_align_circle.icon_id) else: split.prop(tp, "display_circle", text="", icon_value=button_align_circle.icon_id) split.operator("mesh.tp_looptools_circle", text="LoopTools Circle", icon='BLANK1') # circle - settings if tp.display_circle: box = col.box().column(1) row = box.column(1) row.prop(tp, "circle_fit") row.separator() row.prop(tp, "circle_flatten") row = box.row(align=True) row.prop(tp, "circle_custom_radius") row_right = row.row(align=True) row_right.active = tp.circle_custom_radius row_right.prop(tp, "circle_radius", text="") box.prop(tp, "circle_regular") box.separator() col_move = box.column(align=True) row = col_move.row(align=True) if tp.circle_lock_x: row.prop(tp, "circle_lock_x", text = "X", icon='LOCKED') else: row.prop(tp, "circle_lock_x", text = "X", icon='UNLOCKED') if tp.circle_lock_y: row.prop(tp, "circle_lock_y", text = "Y", icon='LOCKED') else: row.prop(tp, "circle_lock_y", text = "Y", icon='UNLOCKED') if tp.circle_lock_z: row.prop(tp, "circle_lock_z", text = "Z", icon='LOCKED') else: row.prop(tp, "circle_lock_z", text = "Z", icon='UNLOCKED') col_move.prop(tp, "circle_influence") box.separator() box = layout.box().column(1) row = box.row(1) # flatten - first line split = row.split(percentage=0.15, align=True) button_align_flatten = icons.get("icon_align_flatten") if tp.display_flatten: split.prop(tp, "display_flatten", text="", icon_value=button_align_flatten.icon_id) else: split.prop(tp, "display_flatten", text="", icon_value=button_align_flatten.icon_id) split.operator("mesh.tp_looptools_flatten", text="LoopTool Flatten", icon ="BLANK1") # flatten - settings if tp.display_flatten: box = col.box().column(1) row = box.column(1) row.prop(tp, "flatten_plane") box.separator() col_move = box.column(align=True) row = col_move.row(align=True) if tp.flatten_lock_x: row.prop(tp, "flatten_lock_x", text = "X", icon='LOCKED') else: row.prop(tp, "flatten_lock_x", text = "X", icon='UNLOCKED') if tp.flatten_lock_y: row.prop(tp, "flatten_lock_y", text = "Y", icon='LOCKED') else: row.prop(tp, "flatten_lock_y", text = "Y", icon='UNLOCKED') if tp.flatten_lock_z: row.prop(tp, "flatten_lock_z", text = "Z", icon='LOCKED') else: row.prop(tp, "flatten_lock_z", text = "Z", icon='UNLOCKED') col_move.prop(tp, "flatten_influence") box.separator() box.separator() row = box.row(1) button_align_planar = icons.get("icon_align_planar") row.operator("mesh.face_make_planar", "Make Planar Faces", icon_value=button_align_planar.icon_id) box.separator()
def poll(cls, context): is_msh_enabled, is_msh_loaded = addon_utils.check('io_mesh_msh') return is_msh_loaded
def draw(self, context): layout = self.layout icons = load_icons() layout.scale_y = 1.2 addon_key = __package__.split(".")[0] panel_prefs = context.user_preferences.addons[addon_key].preferences layout.operator_context = 'INVOKE_REGION_WIN' # PIVOT # Display_Pivot = context.user_preferences.addons[addon_key].preferences.tab_pivot_menu if Display_Pivot == True: layout.menu("VIEW3D_TP_Pivot_Menu", text="Pivot", icon="CURSOR") button_snap_set = icons.get("icon_snap_set") layout.menu("VIEW3D_TP_SnapSet_Menu", text="SnapSet", icon_value=button_snap_set.icon_id) # ORIGIN # Display_Origin = context.user_preferences.addons[addon_key].preferences.tab_origin_menu if Display_Origin == True: layout.separator() layout.menu("VIEW3D_TP_Origin_Menu_Align", text="Origin", icon="LAYER_ACTIVE") # ALIGN TO # Display_Align_to = context.user_preferences.addons[addon_key].preferences.tab_align_to_menu if Display_Align_to == True: layout.separator() if context.mode == 'OBJECT': layout.menu("VIEW3D_TP_Location_Menu", text="Move", icon ="MAN_TRANS") layout.menu("VIEW3D_TP_Rotation_Menu", text="Rotate", icon ="MAN_ROT") layout.menu("VIEW3D_TP_Scale_Menu", text="Scale", icon ="MAN_SCALE") else: layout.menu("VIEW3D_TP_Axis_Menu", text="To Axis", icon ="MANIPUL") # TOOLS # Display_Aligner = context.user_preferences.addons[addon_key].preferences.tab_aligner_menu if Display_Aligner == True: layout.separator() button_origin_align = icons.get("icon_origin_align") layout.menu("VIEW3D_TP_SnapTools_Menu", text="Tools", icon_value=button_origin_align.icon_id) if context.mode == 'OBJECT': # NP STATION # Display_Station = context.user_preferences.addons[addon_key].preferences.tab_station_menu if Display_Station == True: button_snap_grab = icons.get("icon_snap_grab") layout.menu("VIEW3D_TP_Station_Menu", text="Station", icon_value=button_snap_grab.icon_id) # INTERPOLATE # Display_Interpolate = context.user_preferences.addons[addon_key].preferences.tab_interpolate_menu if Display_Interpolate == True: obj = context.active_object if obj: obj_type = obj.type if obj_type in {'MESH'}: layout.separator() layout.operator("mesh.wplsmthdef_snap", text="Save M-State", icon ="SHAPEKEY_DATA") if context.mode == 'EDIT_MESH': # INTERPOLATE # Display_Interpolate = context.user_preferences.addons[addon_key].preferences.tab_interpolate_menu if Display_Interpolate == True: layout.separator() layout.operator("mesh.wplsmthdef_apply", text="Apply S-Deform", icon ="FRAME_NEXT") # SPACE # Display_Space = context.user_preferences.addons[addon_key].preferences.tab_space_menu if Display_Space == True: layout.separator() button_align_straigten = icons.get("icon_align_straigten") layout.menu("VIEW3D_TP_Align_Menu_Space", text="Space", icon_value=button_align_straigten.icon_id) # TINYCAD # Display_TinyCAD = context.user_preferences.addons[addon_key].preferences.tab_tinycad_menu if Display_TinyCAD == True: layout.separator() mesh_tiny_cad_addon = "mesh_tiny_cad" state = addon_utils.check(mesh_tiny_cad_addon) if not state[0]: layout.operator("tp_ops.enable_tinycad", text="!_Activate TinyCAD_!", icon='BLANK1') else: button_tinycad = icons.get("icon_tinycad") layout.menu("VIEW3D_MT_edit_mesh_tinycad", text="TinyCAD", icon_value=button_tinycad.icon_id) # LOOPTOOLS # Display_Looptools = context.user_preferences.addons[addon_key].preferences.tab_looptools_menu if Display_Looptools == True: loop_tools_addon = "mesh_looptools" state = addon_utils.check(loop_tools_addon) if not state[0]: layout.operator("tp_ops.enable_looptools", text="!_Activate Looptools_!", icon='BLANK1') else: layout.separator() button_align_circle = icons.get("icon_align_circle") layout.menu("VIEW3D_TP_Align_Menu_LoopTools", text="LoopTools", icon_value=button_align_circle.icon_id) layout.menu("VIEW3D_TP_Align_Menu_Gstretch", text="GStretch", icon="GREASEPENCIL") # MESHMACHINE # Display_MESHmachine = context.user_preferences.addons[addon_key].preferences.tab_machine_menu if Display_MESHmachine == True: layout.separator() layout.menu("VIEW3D_TP_Machine_Align_Menu", text="MESHmachine", icon="MOD_BEVEL") # RELAX # Display_Relax = context.user_preferences.addons[addon_key].preferences.tab_relax_menu if Display_Relax == True: layout.separator() button_align_shrinkwrap = icons.get("icon_align_shrinkwrap") layout.menu("VIEW3D_TP_Align_Menu_Relax", text="Smooth Relax", icon_value=button_align_shrinkwrap.icon_id) # MIRROR # Display_Mirror = context.user_preferences.addons[addon_key].preferences.tab_mirror_menu if Display_Mirror == True: layout.separator() button_align_mirror_obm = icons.get("icon_align_mirror_obm") layout.menu("VIEW3D_TP_Mirror_Menu", text="Mirror", icon_value=button_align_mirror_obm.icon_id) layout.menu("VIEW3D_TP_ModMirror_Menu", text="Mirror", icon="MOD_MIRROR") # ZERO TO # Display_Zero_to = context.user_preferences.addons[addon_key].preferences.tab_zero_to_menu if Display_Zero_to == True: layout.separator() button_align_zero = icons.get("icon_align_zero") layout.operator("tp_ops.zero_axis", "ZeroAxis", icon_value=button_align_zero.icon_id)
def dump_addon_messages(module_name, messages_formats, do_checks): messages = getattr(collections, 'OrderedDict', dict)() messages[(CONTEXT_DEFAULT, "")] = [] minus_messages = copy.deepcopy(messages) check_ctxt = None minus_check_ctxt = None if do_checks: check_ctxt = {"multi_rnatip": set(), "multi_lines": set(), "py_in_rna": set(), "not_capitalized": set(), "end_point": set(), "undoc_ops": set()} minus_check_ctxt = copy.deepcopy(check_ctxt) # Get current addon state (loaded or not): was_loaded = addon_utils.check(module_name)[1] # Enable our addon and get strings from RNA. enable_addons(addons={module_name}) dump_messages_rna(messages, check_ctxt) # Now disable our addon, and rescan RNA. enable_addons(addons={module_name}, disable=True) dump_messages_rna(minus_messages, minus_check_ctxt) # Restore previous state if needed! if was_loaded: enable_addons(addons={module_name}) # and make the diff! for key in minus_messages: if k == (CONTEXT_DEFAULT, ""): continue del messages[k] if check_ctxt: for key in check_ctxt: for warning in minus_check_ctxt[key]: check_ctxt[key].remove(warning) # and we are done with those! del minus_messages del minus_check_ctxt # get strings from UI layout definitions text="..." args dump_messages_pytext(messages, check_ctxt) del messages[(CONTEXT_DEFAULT, "")] print_warnings if do_messages: print("Writing messages…") num_written = 0 num_filtered = 0 with open(FILE_NAME_MESSAGES, 'w', encoding="utf8") as message_file: for (ctx, key), value in messages.items(): # filter out junk values if filter_message(key): num_filtered += 1 continue # Remove newlines in key and values! message_file.write("\n".join(COMMENT_PREFIX + msgsrc.replace("\n", "") for msgsrc in value)) message_file.write("\n") if ctx: message_file.write(CONTEXT_PREFIX + ctx.replace("\n", "") + "\n") message_file.write(key.replace("\n", "") + "\n") num_written += 1 print("Written {} messages to: {} ({} were filtered out)." "".format(num_written, FILE_NAME_MESSAGES, num_filtered))