====== Differences ====== This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
doc_opener [2015/08/20 11:54] swann [c. file_op] |
doc_opener [2015/08/20 12:07] (current) swann [c. custompath operator] |
||
---|---|---|---|
Line 202: | Line 202: | ||
</code> | </code> | ||
- | <code python> | + | Ici il s'agit du corps de l'opérateur, la fonction execute va s'éxecuter à chaque appel de l'opérateur. Il en est de même ,pour les fonctions draw et invoke. |
+ | <code python> | ||
def execute(self, context): | def execute(self, context): | ||
- | set the string path fo the file here. | + | #ajout du chemin sélectionné |
- | #this is a variable created from the top to start it | + | ressources.Items.append((str(self.properties.filepath),str(self.properties.filepath),"")) |
- | #bpy.context.scene.newF = self.properties.filepath | + | #Création du tuple temporaire |
+ | t=(str(self.properties.filepath),str(self.properties.filepath))) | ||
+ | #Mise à jour de la liste des dossier racine | ||
+ | interface.UpdateEnum(bpy.types.Scene,ressources.Items,'Store',t) | ||
| | ||
- | print("*************SELECTED FILES ***********") | + | #Sauvegarde du dossier sélectionné de manière persistante |
- | for file in self.files: | + | persistence.write_config() |
- | print("FILEPATH %s"%self.properties.filepath)#display the file name and current path | + | #Find de fonction |
- | ressources.Items.append((str(self.properties.filepath),str(self.properties.filepath),"")) | + | return {'FINISHED'} |
- | interface.UpdateEnum(bpy.types.Scene,ressources.Items,'Store',str(self.properties.filepath),str(self.properties.filepath)) | + | |
- | + | #Fonction d'affichage de l'explorateur de fichier | |
- | #Save the config of drives | + | def draw(self, context): |
- | persistence.write_config() | + | self.layout.operator('file.select_all_toggle') |
- | + | def invoke(self, context, event): | |
- | return {'FINISHED'} | + | wm = context.window_manager |
- | + | wm.fileselect_add(self) | |
- | def draw(self, coitemntext): | + | return {'RUNNING_MODAL'} |
- | self.layout.operator('file.select_all_toggle') | + | |
- | def invoke(self, context, event): | + | |
- | wm = context.window_manager | + | |
- | wm.fileselect_add(self) | + | |
- | return {'RUNNING_MODAL'} | + | |
</code> | </code> | ||
---- | ---- |