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

What reasons are there for a Capitalist to oppose a 100% inheritance tax?

What's the in-universe reasoning behind sorcerers needing material components?

Can a virus destroy the BIOS of a modern computer?

How to Aura Handle multiple DmlExceptions

ssTTsSTtRrriinInnnnNNNIiinngg

Watching something be piped to a file live with tail

I'm going to France and my passport expires June 19th

How do conventional missiles fly?

Is the Joker left-handed?

One verb to replace 'be a member of' a club

Why does Optional.map make this assignment work?

Could the museum Saturn V's be refitted for one more flight?

How do I handle a potential work/personal life conflict as the manager of one of my friends?

Is it possible to create a QR code using text?

What does it mean to describe someone as a butt steak?

What about the virus in 12 Monkeys?

What exploit are these user agents trying to use?

Why do bosons tend to occupy the same state?

Why can't we play rap on piano?

How to blend text to background so it looks burned in paint.net?

Can ask the recruiters in my resume to put the reason why I am rejected?

Should I tell management that I intend to leave due to bad software development practices?

Dealing with conflict between co-workers for non-work-related issue affecting their work

Unlock My Phone! February 2018



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













4












$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()









share|improve this question









$endgroup$
















    4












    $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()









    share|improve this question









    $endgroup$














      4












      4








      4





      $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()









      share|improve this question









      $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






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 26 at 15:58









      SylerSyler

      172114




      172114




















          1 Answer
          1






          active

          oldest

          votes


















          7












          $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



          enter image description hereThe 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?






          share|improve this answer











          $endgroup$












          • $begingroup$
            thanks again you are really helpful
            $endgroup$
            – Syler
            Mar 26 at 16:18










          • $begingroup$
            Cheers. Can still do this the ol' fashioned way too, added link.
            $endgroup$
            – batFINGER
            Mar 26 at 16:30











          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
          );



          );













          draft saved

          draft discarded


















          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









          7












          $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



          enter image description hereThe 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?






          share|improve this answer











          $endgroup$












          • $begingroup$
            thanks again you are really helpful
            $endgroup$
            – Syler
            Mar 26 at 16:18










          • $begingroup$
            Cheers. Can still do this the ol' fashioned way too, added link.
            $endgroup$
            – batFINGER
            Mar 26 at 16:30















          7












          $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



          enter image description hereThe 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?






          share|improve this answer











          $endgroup$












          • $begingroup$
            thanks again you are really helpful
            $endgroup$
            – Syler
            Mar 26 at 16:18










          • $begingroup$
            Cheers. Can still do this the ol' fashioned way too, added link.
            $endgroup$
            – batFINGER
            Mar 26 at 16:30













          7












          7








          7





          $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



          enter image description hereThe 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?






          share|improve this answer











          $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



          enter image description hereThe 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?







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Mar 26 at 16:30

























          answered Mar 26 at 16:15









          batFINGERbatFINGER

          26.6k52876




          26.6k52876











          • $begingroup$
            thanks again you are really helpful
            $endgroup$
            – Syler
            Mar 26 at 16:18










          • $begingroup$
            Cheers. Can still do this the ol' fashioned way too, added link.
            $endgroup$
            – batFINGER
            Mar 26 at 16:30
















          • $begingroup$
            thanks again you are really helpful
            $endgroup$
            – Syler
            Mar 26 at 16:18










          • $begingroup$
            Cheers. Can still do this the ol' fashioned way too, added link.
            $endgroup$
            – batFINGER
            Mar 26 at 16:30















          $begingroup$
          thanks again you are really helpful
          $endgroup$
          – Syler
          Mar 26 at 16:18




          $begingroup$
          thanks again you are really helpful
          $endgroup$
          – Syler
          Mar 26 at 16:18












          $begingroup$
          Cheers. Can still do this the ol' fashioned way too, added link.
          $endgroup$
          – batFINGER
          Mar 26 at 16:30




          $begingroup$
          Cheers. Can still do this the ol' fashioned way too, added link.
          $endgroup$
          – batFINGER
          Mar 26 at 16:30

















          draft saved

          draft discarded
















































          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.




          draft saved


          draft discarded














          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





















































          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







          Popular posts from this blog

          Is flight data recorder erased after every flight?When are black boxes used?What protects the location beacon (pinger) of a flight data recorder?Is there anywhere I can pick up raw flight data recorder information?Who legally owns the Flight Data Recorder?Constructing flight recorder dataWhy are FDRs and CVRs still two separate physical devices?What are the data elements shown on the GE235 flight data recorder (FDR) plot?Are CVR and FDR reset after every flight?What is the format of data stored by a Flight Data Recorder?How much data is stored in the flight data recorder per hour in a typical flight of an A380?Is a smart flight data recorder possible?

          Which is better: GPT or RelGAN for text generation?2019 Community Moderator ElectionWhat is the difference between TextGAN and LM for text generation?GANs (generative adversarial networks) possible for text as well?Generator loss not decreasing- text to image synthesisChoosing a right algorithm for template-based text generationHow should I format input and output for text generation with LSTMsGumbel Softmax vs Vanilla Softmax for GAN trainingWhich neural network to choose for classification from text/speech?NLP text autoencoder that generates text in poetic meterWhat is the interpretation of the expectation notation in the GAN formulation?What is the difference between TextGAN and LM for text generation?How to prepare the data for text generation task

          Is there a general name for the setup in which payoffs are not known exactly but players try to influence each other's perception of the payoffs?Osborne, Nash equilibria and the correctness of beliefsIs there a name for this family of games (Binomial games?)?Perfect Bayesian EquilibriumCalculating mixed strategy equilibrium in battle of sexesPure Strategy SPNEIs there a commitment mechanism which allows players to achieve pareto optimal solutions?Extensive Form GamesAn $n$-player prisoner's dilemma where a coalition of 2 players is better off defectingTit-For-Stat Strategy Best RepliesPotential solutions of the $n$-player Prisoner's Dilemma