[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4698: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4700: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4701: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4702: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
Blenderlounge • Consulter le sujet - Propriétés d'un type aaaaajnjcbdjhc

Propriétés d'un type

Ici on parle des scripts

Modérateurs : frez, Yadoob, stilobique, Matpi, ModSquad

Propriétés d'un type

Message par Brice » 18 Déc 2014, 20:25

Bonjour, est-ce que pour un type donné on peut récupérer dynamiquement la liste de ses propriétés :?:
Par exemple pour bpy.types.Modifier la propriété name.
Avatar de l’utilisateur
Brice
 
Message(s) : 44
Inscription : 21 Sep 2013, 19:20

Re: Propriétés d'un type

Message par lapineige » 18 Déc 2014, 21:35

C'est à dire ? récupérer le name d'un modifier, ou tout les propriétés ?
Mon terrier/blog: https://lapineige.fr/wp (l'ancien: le-terrier-de-lapineige.over-blog.com) | Mon GitHub: https://github.com/lapineige/Blender_add-ons | Lapineige's Tools: http://cgcookiemarkets.com/blender/all- ... ompilation
Avatar de l’utilisateur
lapineige
 
Message(s) : 3717
Inscription : 25 Juin 2014, 07:06

Re: Propriétés d'un type

Message par Brice » 18 Déc 2014, 22:19

Non toutes évidemment, sinon il suffit d'y accéder directement, donc name, show_expanded etc.
Avatar de l’utilisateur
Brice
 
Message(s) : 44
Inscription : 21 Sep 2013, 19:20

Re: Propriétés d'un type

Message par lapineige » 18 Déc 2014, 22:54

Mon terrier/blog: https://lapineige.fr/wp (l'ancien: le-terrier-de-lapineige.over-blog.com) | Mon GitHub: https://github.com/lapineige/Blender_add-ons | Lapineige's Tools: http://cgcookiemarkets.com/blender/all- ... ompilation
Avatar de l’utilisateur
lapineige
 
Message(s) : 3717
Inscription : 25 Juin 2014, 07:06

Re: Propriétés d'un type

Message par Matpi » 18 Déc 2014, 22:56

Si j'ai bien compris ce que tu cherches à faire, tu peux simplement appliquer la fonction dir() sur ton objet, cela te rend la liste des noms des attributs de l'objet.

Dans le cas où ensuite tu cherches à récupérer l'attribut correspondant à un nom de cette liste, tu as la fonction getattr().


EDIT: grillééééééé.....
BAddons - La Collection d'Addons de Matpi:
Avatar de l’utilisateur
Matpi
 
Message(s) : 288
Inscription : 07 Déc 2014, 10:51
Localisation : in dr Schwiiz

Re: Propriétés d'un type

Message par lapineige » 18 Déc 2014, 23:09

Et sinon t'as aussi le hasattr(), pour voir s'il a un certain attribut (très, très pratique, plutôt que de mettre des try/except)


@Matpi: par un lapin, que c'est cocasse :lol:
Bah tu me l'as bien fait l'autre jour avec le fbx :-D
Mon terrier/blog: https://lapineige.fr/wp (l'ancien: le-terrier-de-lapineige.over-blog.com) | Mon GitHub: https://github.com/lapineige/Blender_add-ons | Lapineige's Tools: http://cgcookiemarkets.com/blender/all- ... ompilation
Avatar de l’utilisateur
lapineige
 
Message(s) : 3717
Inscription : 25 Juin 2014, 07:06

Re: Propriétés d'un type

Message par Matpi » 18 Déc 2014, 23:23

Sans compter le setattr() ;-)
BAddons - La Collection d'Addons de Matpi:
Avatar de l’utilisateur
Matpi
 
Message(s) : 288
Inscription : 07 Déc 2014, 10:51
Localisation : in dr Schwiiz

Re: Propriétés d'un type

Message par lapineige » 18 Déc 2014, 23:30

Mon terrier/blog: https://lapineige.fr/wp (l'ancien: le-terrier-de-lapineige.over-blog.com) | Mon GitHub: https://github.com/lapineige/Blender_add-ons | Lapineige's Tools: http://cgcookiemarkets.com/blender/all- ... ompilation
Avatar de l’utilisateur
lapineige
 
Message(s) : 3717
Inscription : 25 Juin 2014, 07:06

Re: Propriétés d'un type

Message par Brice » 19 Déc 2014, 00:09

dir() donne bien ce que je cherche, merci à vous. :)

nb : Sur le dernier j'ai une erreur de __dic__ qui n'existe pas.
Avatar de l’utilisateur
Brice
 
Message(s) : 44
Inscription : 21 Sep 2013, 19:20


Retour vers Scripts - Python - OSL

Qui est en ligne ?

Utilisateur(s) parcourant ce forum : Aucun utilisateur inscrit et 1 invité

cron