Timeline for How to access bpy.props.StringProperty() from a different class?
Current License: CC BY-SA 4.0
10 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Feb 22, 2021 at 17:36 | comment | added | batFINGER |
Need to import it first. (edited) Please Notice the questioner has used bpy.props.StringProperty . in question title.. Whereas I normally import as now shown.
|
|
Feb 22, 2021 at 17:33 | history | edited | batFINGER | CC BY-SA 4.0 |
added 44 characters in body
|
Feb 22, 2021 at 17:24 | comment | added | Tango | I tried the first one-liner (bpy.types.Scene.xxx = StringProperty() ) in the console and get "NameError: name 'StringPropety' is not defined". | |
Nov 29, 2019 at 11:50 | comment | added | batFINGER |
Could be. I believe they are all connected to the question. Hence posting as an answer. Pressing a button is "invoking from UI". Used print as an example akn to print(my_type) in question. A panel or operator has layout in its draw method. Re simple global eg adding a scene property, Seen in answer here too. blender.stackexchange.com/questions/132944/… you may wsh to draw it in a panel.
|
|
Nov 29, 2019 at 10:54 | comment | added | globglob | Hi, thank you for your answer, isn't there a more straightforward way? It feels like more of a workaround to my problem than a clean solution. Is there no way to declare a variable that is global to the whole addon? Also I'm really not sure how to include your solution to my code, you are talking about printing and using in layout and invoking from UI but this are all things that aren't connected to my questions from what I understand. Could be wrong though, if you could clarify/simplify your answer it would really help. Thanks again | |
Nov 28, 2019 at 15:46 | history | edited | batFINGER | CC BY-SA 4.0 |
deleted 118 characters in body
|
Nov 28, 2019 at 15:44 | comment | added | Robert Gützkow |
I've tested it and only C.window_manager.operator_properties_last("object.simple_operator") works properly. C.window_manager.operators['OBJECT_OT_simple_operator'] fails without UNDO . I think managing the state in the add-on yourself may be the cleaner solution.
|
|
Nov 28, 2019 at 15:35 | comment | added | batFINGER | @RobertGützkow Works without. Test with simple operator template. | |
Nov 28, 2019 at 15:13 | history | edited | batFINGER | CC BY-SA 4.0 |
added 555 characters in body
|
Nov 28, 2019 at 15:06 | history | answered | batFINGER | CC BY-SA 4.0 |