11/19/2023 0 Comments Maxon cinema 4d r16![]() # Attempt to import a local module called "myModule" if "myModule" not in sys. # Invoking "import myModule" might replace the module of that other plugin with the local # module "myModule", rendering the other plugin non-functional or even causing Cinema 4D # to crash. There is either another plugin installed on the machine which happens to also have a # local module called "myModule" or there is a globally installed module "myModule. Invoking # "import myModule" again will do no harm in this case (and also have no effect). One's plugin has run before and already imported the module before. There are two scenarios how a local # module called "myModule" could already be present: # 1. join ( root, "modules" )) # One must check if there is already a module present before importing a local module and if # this is the case, refrain from importing the local module. ![]() +- modules <- Contains the local modules/packages | +- _init_.py | +- myModule.py <- A module to import +- myPlugin.pyp <- The plugin that is meant to import from MyPlugin/modules """ import os import sys # Get the directory the plugin is located in and add the directory called "modules" in this root # directory to the search paths of the Python instance executing this file. """Code example for loading local modules for a plugin with the following structure: MyPlugin +- res +. ~/Library/Preferences/MAXON/python311/libs ~/Library/Preferences/MAXON/python310/libs ~/Library/Preferences/MAXON/python39/libs All apps that use the targeted Python interpreter will be able import modules from these paths. Note that these directories only do exist when their respective app has been run at least once.įor cases where the complexity of app specific search paths is not required, the search paths for specific Python versions can be used instead. These six directories will all share a common hash prefix for the installation but are differentiated by a postfix. ![]() For a singular Cinema 4D installation up to six preferences directories can exist, one directory for each app shipped with Cinema 4D. ~/Library/Preferences/MAXON/ stands for the distinct preferences directories of the different apps that are being shipped with a Cinema 4D installation. The search paths can be located with the following patterns: The app specific search paths are all tied to a specific installation of Cinema 4D and also differentiate between the apps that have been shipped with that Cinema 4D installation, as for example the Cinema 4D, c4dpy, or commandline executable. One for libraries which are intended for a specific installation of an app, and one for all apps that use a specific version of Python. There are in principle two predefined search paths into which libraries can be placed for each app inside an installation of Cinema 4D. Installation & App Specific Search Paths ¶
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |