def on_load_post(context): global appended_py_paths global context_screen context_screen = bpy.context.screen props.init_properties_on_load() reload_blend_data() bpy.ops.arm.sync_proxy() wrd = bpy.data.worlds['Arm'] wrd.arm_recompile = True arm.api.drivers = dict() # Load libraries if os.path.exists(arm.utils.get_fp() + '/Libraries'): libs = os.listdir(arm.utils.get_fp() + '/Libraries') for lib in libs: if os.path.isdir(arm.utils.get_fp() + '/Libraries/' + lib): fp = arm.utils.get_fp() + '/Libraries/' + lib if fp not in appended_py_paths and os.path.exists( fp + '/blender.py'): appended_py_paths.append(fp) sys.path.append(fp) import blender importlib.reload(blender) blender.register() sys.path.remove(fp) # Show trait users as collections arm.utils.update_trait_collections()
def on_load_post(context): global appended_py_paths global first_update first_update = True props.init_properties_on_load() reload_blend_data() bpy.ops.arm.sync_proxy() wrd = bpy.data.worlds['Arm'] wrd.arm_recompile = True if os.path.exists(arm.utils.get_fp() + '/Libraries'): libs = os.listdir(arm.utils.get_fp() + '/Libraries') for lib in libs: if os.path.isdir(arm.utils.get_fp() + '/Libraries/' + lib): fp = arm.utils.get_fp() + '/Libraries/' + lib if fp not in appended_py_paths and os.path.exists( fp + '/blender.py'): sys.path.append(fp) appended_py_paths.append(fp) import blender blender.register() arm.utils.update_trait_groups()
def register(): organism_builder = OrganismBuilder(util, data.ProcessModel, data.Organism) mesh_factory = geometry.CoreMeshFactory.create() world_builder = WorldBuilder(organism_builder, mesh_factory) physics_builder = PhysicsBuilder() simulation_builder = SimulationBuilder() runner_builder = RunnerBuilder() plugin = SDSPlugin(world_builder, simulation_builder, physics_builder, runner_builder) blender.register(plugin)
def on_load_post(context): global appended_py_paths props.init_properties_on_load() nodes_renderpath.reload_blend_data() # Check for blender.py scripts in enabled libraries # for fp in appended_py_paths: # sys.path.remove(fp) # appended_py_paths = [] wrd = bpy.data.worlds['Arm'] for lib in wrd.my_librarytraitlist: if lib.enabled_prop: fp = armutils.get_fp() + '/Libraries/' + lib.name if fp not in appended_py_paths and os.path.exists(fp + '/blender.py'): # if os.path.exists(fp + '/blender.py'): sys.path.append(fp) appended_py_paths.append(fp) import blender blender.register()
def on_load_post(context): global appended_py_paths global first_update first_update = True props.init_properties_on_load() make_renderer.reload_blend_data() wrd = bpy.data.worlds['Arm'] wrd.arm_recompile = True for lib in wrd.my_librarytraitlist: if lib.enabled_prop: fp = arm.utils.get_fp() + '/Libraries/' + lib.name if fp not in appended_py_paths and os.path.exists(fp + '/blender.py'): sys.path.append(fp) appended_py_paths.append(fp) import blender blender.register()
def load_libraries(): lib_path = os.path.join(arm.utils.get_fp(), 'Libraries') if os.path.exists(lib_path): # Don't register nodes twice when calling register_nodes() arm_nodes.reset_globals() # Make sure that Armory's categories are registered first (on top of the menu) arm.logicnode.init_categories() libs = os.listdir(lib_path) for lib in libs: fp = os.path.join(lib_path, lib) if os.path.isdir(fp): if fp not in appended_py_paths and os.path.exists( os.path.join(fp, 'blender.py')): appended_py_paths.append(fp) sys.path.append(fp) import blender importlib.reload(blender) blender.register() sys.path.remove(fp) # Register newly added nodes and node categories arm.nodes_logic.register_nodes()