How to make floating windows/panels

Hi There …:slight_smile:

I’m looking for some code
how to make UI floating windows/panels for some buttons ? (such as: “blender user reference” panel)

as I know blender can make UI List, menu and panel (but the panel joined with other panels)

is it possible in blender , any idea or an example ?

You can make a popup but it does not float. You can not reposition or drag it around the screen.

Hi Atom, thanks for your replies

a popup … is it same with UI Menu ?
mm … I just want floating window can drag it around the screen
because every buttons for global function, not for specific category.

about popup… how to call a popup, is it with keyboard shortcut key ?
how to create shortcut by script ? any idea ?

The user preferences work like this: a new blender window is opened with a single area, and that is set to type user prefs.

You can do this in script like:

import bpy

area = bpy.context.area
t = area.type
area.type = 'VIEW_3D'
bpy.ops.screen.area_dupli('INVOKE_DEFAULT')
area.type = t

This is a popup:

import bpy


def main(context):
    for ob in context.scene.objects:
        print(ob)


class SimpleOperator(bpy.types.Operator):
    """Tooltip"""
    bl_idname = "object.simple_operator"
    bl_label = "Simple Object Operator"
    bl_options = {'REGISTER', 'UNDO'}
    
    my_string = bpy.props.StringProperty("My String")
    my_int = bpy.props.IntProperty("My Int")

    @classmethod
    def poll(cls, context):
        return context.active_object is not None

    def invoke(self, context, event):
        return context.window_manager.invoke_props_popup(self, event)

    def execute(self, context):
        main(context)
        return {'FINISHED'}


def register():
    bpy.utils.register_class(SimpleOperator)


def unregister():
    bpy.utils.unregister_class(SimpleOperator)


if __name__ == "__main__":
    register()

    # test call
    bpy.ops.object.simple_operator('INVOKE_DEFAULT')


thanks CoDEmanX

that’s cool, but I still confused…
where I can find the result of second script ?

I am experienced with 3dsMAXScript,
example like this:


so if Blender can make “UI menu” then I need code to create a keyboard shortcut to open UI menu.

how to create/link it to a keyboard shortcut by script ? (ie: CTRL+SHIFT+Y)

hi… I think you should see this tuto :

also this was usefull for me:http://wiki.blender.org/index.php/Dev:2.5/Source/Development/WinterCamp/TechnicalDesign

best

Diego

Hi YHOYO, thanks
that’s nice …

but it’s can make untidy the UI blender if I do something wrong… LOL
it’s ok, I thinking of that too

regard

Budi

where I can find the result of second script ?

Run it in the text editor and it will invoke automatically, showing a props popup.

how to create/link it to a keyboard shortcut by script ? (ie: CTRL+SHIFT+Y)

http://www.blender.org/documentation/blender_python_api_2_70_4/info_tutorial_addon.html#keymap

Replace
ObjectCursorArray.bl_idname by “wm.call_menu”

and kmi.properties.total = 4 by
kmi.properties.name = “your_menu_bl_idname”

If you need an example of a menu class, see the text editor templates.

oops my fault… Im sorry, i’m not copy a whole scripts from you before

but now its works

ok great, I see your point

thank you very much

CoDEmanX