I am writing a simple foundation for an addon.
There are two different scripts i have. Both are very similar. One has properties defined in a class the other into bpy.context.scene (or is it bpy.types.Scene, what is the difference? - more on that below).
globalTest.py
classTest.py
are the names of the files
in global test i can use a button to print out the user set value, but i am not sure how to do that using classes, however my gui does not work: i cannot update any values for some reason.
in class test my gui works, all the values update, but i do not know how to communicate the values between classes.
I am fine with using either way as long as both of my problems are fixed
a note on the properties…
in globalTest:
i am setting the properties via
bpy.types.Scene
scn.intNum = IntProperty(name=‘Number’, description='Number >1 ', min=1, default=1, update=update_fnc)
and using them via (in the draw function)
cScn = bpy.context.scene
self.layout.box().row().prop(cScn, ‘intNum’)
in class test:
i am setting the properties via
intNum = IntProperty(name=‘Number’, description='Number > 1 ', min=1, default=1, update=update_fnc)
and using them via (in the draw function)
self.layout.box().row().prop(self, ‘intNum’)
Not sure how to fix my problems, any help is appreciated!
*** Files are attached with a .blend extension -> rename to .py extension
*** Run in code editor in blender, then go to add->mesh->addPanel the window will be all the way down in the object toolbar (T-Key)
*** To see the print messages open the blender console by clicking Window->ToggleSystemConsole
Attachments
classTest.blend (3.36 KB)globalTest.blend (3.31 KB)