Best way to store options for panelsHow to dynamically show/hide panel elements using python?Prepare a set of parameters for reuse in multiple panelsHow to create toggle buttons in blender GUI from dynamic list of items?Best/ preferred way of storing Image references?Hide panels with pythonModal operators not working when used through pop-up menuWhat is the best way to store a list of objects with some linked data?vertex coordinates in panel made with python script do not updatebpy_struct for accessing key indentifiers in a keyvalue pair(dict) in a menuStore current region 3dStore object for operator
Is there an Impartial Brexit Deal comparison site?
How do I keep an essay about "feeling flat" from feeling flat?
Valid Badminton Score?
The plural of 'stomach"
What is the oldest known work of fiction?
How can a jailer prevent the Forge Cleric's Artisan's Blessing from being used?
There is only s̶i̶x̶t̶y one place he can be
How does a character multiclassing into warlock get a focus?
Is exact Kanji stroke length important?
Is there a problem with hiding "forgot password" until it's needed?
Short story about robots exploring another planet whose inhabitants thought the robots were inferior
Increase performance creating Mandelbrot set in python
Are there any thematic similarities between Shostakovichs' Symphony 5th and Beethovens' 7th symphony?
Why does John Bercow say “unlock” after reading out the results of a vote?
Is it okay / does it make sense for another player to join a running game of Munchkin?
What's the purpose of "true" in bash "if sudo true; then"
Star/Wye electrical connection math symbol
How can I use the arrow sign in my bash prompt?
Is there any reason not to eat food that's been dropped on the surface of the moon?
How to verify if g is a generator for p?
Why "be dealt cards" rather than "be dealing cards"?
Time travel short story where a man arrives in the late 19th century in a time machine and then sends the machine back into the past
Your magic is very sketchy
Do I need a multiple entry visa for a trip UK -> Sweden -> UK?
Best way to store options for panels
How to dynamically show/hide panel elements using python?Prepare a set of parameters for reuse in multiple panelsHow to create toggle buttons in blender GUI from dynamic list of items?Best/ preferred way of storing Image references?Hide panels with pythonModal operators not working when used through pop-up menuWhat is the best way to store a list of objects with some linked data?vertex coordinates in panel made with python script do not updatebpy_struct for accessing key indentifiers in a keyvalue pair(dict) in a menuStore current region 3dStore object for operator
$begingroup$
lets say i have a panel and i want to collapse a part if a bool is False
import bpy
class HelloWorldPanel(bpy.types.Panel):
"""Creates a Panel in the Object properties window"""
bl_label = "Hello World Panel"
bl_idname = "OBJECT_PT_hello"
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "object"
def draw(self, context):
layout = self.layout
# where should i define this bool ?
layout.prop(place, "bool")
if bool is True:
obj = context.object
row = layout.row()
row.label(text="Hello world!", icon='WORLD_DATA')
row = layout.row()
row.label(text="Active object is: " + obj.name)
def register():
bpy.utils.register_class(HelloWorldPanel)
def unregister():
bpy.utils.unregister_class(HelloWorldPanel)
if __name__ == "__main__":
register()
python
$endgroup$
add a comment |
$begingroup$
lets say i have a panel and i want to collapse a part if a bool is False
import bpy
class HelloWorldPanel(bpy.types.Panel):
"""Creates a Panel in the Object properties window"""
bl_label = "Hello World Panel"
bl_idname = "OBJECT_PT_hello"
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "object"
def draw(self, context):
layout = self.layout
# where should i define this bool ?
layout.prop(place, "bool")
if bool is True:
obj = context.object
row = layout.row()
row.label(text="Hello world!", icon='WORLD_DATA')
row = layout.row()
row.label(text="Active object is: " + obj.name)
def register():
bpy.utils.register_class(HelloWorldPanel)
def unregister():
bpy.utils.unregister_class(HelloWorldPanel)
if __name__ == "__main__":
register()
python
$endgroup$
add a comment |
$begingroup$
lets say i have a panel and i want to collapse a part if a bool is False
import bpy
class HelloWorldPanel(bpy.types.Panel):
"""Creates a Panel in the Object properties window"""
bl_label = "Hello World Panel"
bl_idname = "OBJECT_PT_hello"
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "object"
def draw(self, context):
layout = self.layout
# where should i define this bool ?
layout.prop(place, "bool")
if bool is True:
obj = context.object
row = layout.row()
row.label(text="Hello world!", icon='WORLD_DATA')
row = layout.row()
row.label(text="Active object is: " + obj.name)
def register():
bpy.utils.register_class(HelloWorldPanel)
def unregister():
bpy.utils.unregister_class(HelloWorldPanel)
if __name__ == "__main__":
register()
python
$endgroup$
lets say i have a panel and i want to collapse a part if a bool is False
import bpy
class HelloWorldPanel(bpy.types.Panel):
"""Creates a Panel in the Object properties window"""
bl_label = "Hello World Panel"
bl_idname = "OBJECT_PT_hello"
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "object"
def draw(self, context):
layout = self.layout
# where should i define this bool ?
layout.prop(place, "bool")
if bool is True:
obj = context.object
row = layout.row()
row.label(text="Hello world!", icon='WORLD_DATA')
row = layout.row()
row.label(text="Active object is: " + obj.name)
def register():
bpy.utils.register_class(HelloWorldPanel)
def unregister():
bpy.utils.unregister_class(HelloWorldPanel)
if __name__ == "__main__":
register()
python
python
asked 3 hours ago
SylerSyler
12812
12812
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
$begingroup$
Blender 2.8 has sub panels.
As of blender 2.8 can if bl_parent_id is set in a panel it will be appended to the parent panel. Use the usual 'DEFAULT_CLOSED' in the bl_options set to start with panel closed.
This avoids needing to set up some boolean property to open close UI altogether.
Here is a sample file I've been testing for ordering panels. First panel is defined as a child of the object transform panel. Second panel is a child of first. Can unregister and re-register with different parent ids to sort sub-panels, which is what I was testing
The two demo sub panels appended to object transform
import bpy
from bl_ui.properties_object import ObjectButtonsPanel, OBJECT_PT_transform
class LayoutDemoPanel(bpy.types.Panel, ObjectButtonsPanel):
bl_label = "Layout Demo"
bl_idname = "SCENE_PT_layout"
bl_parent_id = 'OBJECT_PT_transform'
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
def draw(self, context):
layout = self.layout
scene = context.scene
# Create a simple row.
layout.label(text=" Simple Row:")
row = layout.row()
row.prop(scene, "frame_start")
class LayoutDemoPanel2(bpy.types.Panel, ObjectButtonsPanel):
bl_label = "Layout Demo 2"
bl_idname = "SCENE_PT_layout2"
bl_parent_id = 'SCENE_PT_layout'
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
def draw(self, context):
layout = self.layout
scene = context.scene
# Create a simple row.
layout.label(text=" Simple Row:")
row = layout.row()
row.prop(scene, "frame_start")
def register():
bpy.utils.register_class(LayoutDemoPanel)
bpy.utils.register_class(LayoutDemoPanel2)
def unregister():
bpy.utils.unregister_class(LayoutDemoPanel2)
bpy.utils.unregister_class(LayoutDemoPanel1)
if __name__ == "__main__":
register()
If you have some logical setting that when set needs more UI How to dynamically show/hide panel elements using python?
$endgroup$
$begingroup$
thanks again you are really helpful
$endgroup$
– Syler
3 hours ago
$begingroup$
Cheers. Can still do this the ol' fashioned way too, added link.
$endgroup$
– batFINGER
2 hours ago
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
return StackExchange.using("mathjaxEditing", function ()
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix)
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
);
);
, "mathjax-editing");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "502"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fblender.stackexchange.com%2fquestions%2f135372%2fbest-way-to-store-options-for-panels%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
$begingroup$
Blender 2.8 has sub panels.
As of blender 2.8 can if bl_parent_id is set in a panel it will be appended to the parent panel. Use the usual 'DEFAULT_CLOSED' in the bl_options set to start with panel closed.
This avoids needing to set up some boolean property to open close UI altogether.
Here is a sample file I've been testing for ordering panels. First panel is defined as a child of the object transform panel. Second panel is a child of first. Can unregister and re-register with different parent ids to sort sub-panels, which is what I was testing
The two demo sub panels appended to object transform
import bpy
from bl_ui.properties_object import ObjectButtonsPanel, OBJECT_PT_transform
class LayoutDemoPanel(bpy.types.Panel, ObjectButtonsPanel):
bl_label = "Layout Demo"
bl_idname = "SCENE_PT_layout"
bl_parent_id = 'OBJECT_PT_transform'
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
def draw(self, context):
layout = self.layout
scene = context.scene
# Create a simple row.
layout.label(text=" Simple Row:")
row = layout.row()
row.prop(scene, "frame_start")
class LayoutDemoPanel2(bpy.types.Panel, ObjectButtonsPanel):
bl_label = "Layout Demo 2"
bl_idname = "SCENE_PT_layout2"
bl_parent_id = 'SCENE_PT_layout'
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
def draw(self, context):
layout = self.layout
scene = context.scene
# Create a simple row.
layout.label(text=" Simple Row:")
row = layout.row()
row.prop(scene, "frame_start")
def register():
bpy.utils.register_class(LayoutDemoPanel)
bpy.utils.register_class(LayoutDemoPanel2)
def unregister():
bpy.utils.unregister_class(LayoutDemoPanel2)
bpy.utils.unregister_class(LayoutDemoPanel1)
if __name__ == "__main__":
register()
If you have some logical setting that when set needs more UI How to dynamically show/hide panel elements using python?
$endgroup$
$begingroup$
thanks again you are really helpful
$endgroup$
– Syler
3 hours ago
$begingroup$
Cheers. Can still do this the ol' fashioned way too, added link.
$endgroup$
– batFINGER
2 hours ago
add a comment |
$begingroup$
Blender 2.8 has sub panels.
As of blender 2.8 can if bl_parent_id is set in a panel it will be appended to the parent panel. Use the usual 'DEFAULT_CLOSED' in the bl_options set to start with panel closed.
This avoids needing to set up some boolean property to open close UI altogether.
Here is a sample file I've been testing for ordering panels. First panel is defined as a child of the object transform panel. Second panel is a child of first. Can unregister and re-register with different parent ids to sort sub-panels, which is what I was testing
The two demo sub panels appended to object transform
import bpy
from bl_ui.properties_object import ObjectButtonsPanel, OBJECT_PT_transform
class LayoutDemoPanel(bpy.types.Panel, ObjectButtonsPanel):
bl_label = "Layout Demo"
bl_idname = "SCENE_PT_layout"
bl_parent_id = 'OBJECT_PT_transform'
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
def draw(self, context):
layout = self.layout
scene = context.scene
# Create a simple row.
layout.label(text=" Simple Row:")
row = layout.row()
row.prop(scene, "frame_start")
class LayoutDemoPanel2(bpy.types.Panel, ObjectButtonsPanel):
bl_label = "Layout Demo 2"
bl_idname = "SCENE_PT_layout2"
bl_parent_id = 'SCENE_PT_layout'
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
def draw(self, context):
layout = self.layout
scene = context.scene
# Create a simple row.
layout.label(text=" Simple Row:")
row = layout.row()
row.prop(scene, "frame_start")
def register():
bpy.utils.register_class(LayoutDemoPanel)
bpy.utils.register_class(LayoutDemoPanel2)
def unregister():
bpy.utils.unregister_class(LayoutDemoPanel2)
bpy.utils.unregister_class(LayoutDemoPanel1)
if __name__ == "__main__":
register()
If you have some logical setting that when set needs more UI How to dynamically show/hide panel elements using python?
$endgroup$
$begingroup$
thanks again you are really helpful
$endgroup$
– Syler
3 hours ago
$begingroup$
Cheers. Can still do this the ol' fashioned way too, added link.
$endgroup$
– batFINGER
2 hours ago
add a comment |
$begingroup$
Blender 2.8 has sub panels.
As of blender 2.8 can if bl_parent_id is set in a panel it will be appended to the parent panel. Use the usual 'DEFAULT_CLOSED' in the bl_options set to start with panel closed.
This avoids needing to set up some boolean property to open close UI altogether.
Here is a sample file I've been testing for ordering panels. First panel is defined as a child of the object transform panel. Second panel is a child of first. Can unregister and re-register with different parent ids to sort sub-panels, which is what I was testing
The two demo sub panels appended to object transform
import bpy
from bl_ui.properties_object import ObjectButtonsPanel, OBJECT_PT_transform
class LayoutDemoPanel(bpy.types.Panel, ObjectButtonsPanel):
bl_label = "Layout Demo"
bl_idname = "SCENE_PT_layout"
bl_parent_id = 'OBJECT_PT_transform'
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
def draw(self, context):
layout = self.layout
scene = context.scene
# Create a simple row.
layout.label(text=" Simple Row:")
row = layout.row()
row.prop(scene, "frame_start")
class LayoutDemoPanel2(bpy.types.Panel, ObjectButtonsPanel):
bl_label = "Layout Demo 2"
bl_idname = "SCENE_PT_layout2"
bl_parent_id = 'SCENE_PT_layout'
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
def draw(self, context):
layout = self.layout
scene = context.scene
# Create a simple row.
layout.label(text=" Simple Row:")
row = layout.row()
row.prop(scene, "frame_start")
def register():
bpy.utils.register_class(LayoutDemoPanel)
bpy.utils.register_class(LayoutDemoPanel2)
def unregister():
bpy.utils.unregister_class(LayoutDemoPanel2)
bpy.utils.unregister_class(LayoutDemoPanel1)
if __name__ == "__main__":
register()
If you have some logical setting that when set needs more UI How to dynamically show/hide panel elements using python?
$endgroup$
Blender 2.8 has sub panels.
As of blender 2.8 can if bl_parent_id is set in a panel it will be appended to the parent panel. Use the usual 'DEFAULT_CLOSED' in the bl_options set to start with panel closed.
This avoids needing to set up some boolean property to open close UI altogether.
Here is a sample file I've been testing for ordering panels. First panel is defined as a child of the object transform panel. Second panel is a child of first. Can unregister and re-register with different parent ids to sort sub-panels, which is what I was testing
The two demo sub panels appended to object transform
import bpy
from bl_ui.properties_object import ObjectButtonsPanel, OBJECT_PT_transform
class LayoutDemoPanel(bpy.types.Panel, ObjectButtonsPanel):
bl_label = "Layout Demo"
bl_idname = "SCENE_PT_layout"
bl_parent_id = 'OBJECT_PT_transform'
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
def draw(self, context):
layout = self.layout
scene = context.scene
# Create a simple row.
layout.label(text=" Simple Row:")
row = layout.row()
row.prop(scene, "frame_start")
class LayoutDemoPanel2(bpy.types.Panel, ObjectButtonsPanel):
bl_label = "Layout Demo 2"
bl_idname = "SCENE_PT_layout2"
bl_parent_id = 'SCENE_PT_layout'
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
def draw(self, context):
layout = self.layout
scene = context.scene
# Create a simple row.
layout.label(text=" Simple Row:")
row = layout.row()
row.prop(scene, "frame_start")
def register():
bpy.utils.register_class(LayoutDemoPanel)
bpy.utils.register_class(LayoutDemoPanel2)
def unregister():
bpy.utils.unregister_class(LayoutDemoPanel2)
bpy.utils.unregister_class(LayoutDemoPanel1)
if __name__ == "__main__":
register()
If you have some logical setting that when set needs more UI How to dynamically show/hide panel elements using python?
edited 2 hours ago
answered 3 hours ago
batFINGERbatFINGER
26.1k52876
26.1k52876
$begingroup$
thanks again you are really helpful
$endgroup$
– Syler
3 hours ago
$begingroup$
Cheers. Can still do this the ol' fashioned way too, added link.
$endgroup$
– batFINGER
2 hours ago
add a comment |
$begingroup$
thanks again you are really helpful
$endgroup$
– Syler
3 hours ago
$begingroup$
Cheers. Can still do this the ol' fashioned way too, added link.
$endgroup$
– batFINGER
2 hours ago
$begingroup$
thanks again you are really helpful
$endgroup$
– Syler
3 hours ago
$begingroup$
thanks again you are really helpful
$endgroup$
– Syler
3 hours ago
$begingroup$
Cheers. Can still do this the ol' fashioned way too, added link.
$endgroup$
– batFINGER
2 hours ago
$begingroup$
Cheers. Can still do this the ol' fashioned way too, added link.
$endgroup$
– batFINGER
2 hours ago
add a comment |
Thanks for contributing an answer to Blender Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
Use MathJax to format equations. MathJax reference.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fblender.stackexchange.com%2fquestions%2f135372%2fbest-way-to-store-options-for-panels%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown