4
$\begingroup$

I am trying to add a button on the tool panel for material which should open the material editor in a dialog box, which should be resizeable.

I can do the button but am having trouble creating the dialog box.

I tried to Do this by making duplicate window and dislplaying the properties editor in full screen but it takes up the whole screen.

I can make simple scripts in blender but don' know how to this.

Any help is much apreciated.

import bpy
from bpy.types import Header  

bpy.ops.wm.window_duplicate()  
bpy.ops.screen.screen_full_area()  
bpy.context.area.type='PROPERTIES'  
$\endgroup$
4
$\begingroup$

This is where terminology is important (area vs. window). Your current Blender window is full screen, so duplicating that window results in another full screen window. You might have better success if you try the bpy.ops.screen.area_dupli() operator and duplicate the area that contains the existing Properties Editor in your layout. The only caveat is that you need to first set that as your active area.

$\endgroup$
  • 2
    $\begingroup$ You can use a context override to avoid changing the active area! But I would actually try to find an existing area of a certain type first, and if there's none, duplicate the one with the largest area: pasteall.org/51468/python $\endgroup$ – CoDEmanX May 9 '14 at 15:43
  • $\begingroup$ Huh, it worked. Now how can I switch to material screen if an object is selected and I press the button. $\endgroup$ – user3424 May 10 '14 at 15:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.