Commit Graph

13 Commits

Author SHA1 Message Date
Thomas Dinges
ef01c5bf0a 2.5 Buttons Code:
* Code Cleanup.
* Tiny layout changes.
* Added proper context for bone, curve, mesh and text objects. 

* Fixed Sun/Sky context.
2009-05-24 12:37:55 +00:00
Thomas Dinges
34aaa18af2 2.5 Buttons:
* More button tweaks by William Reynish. Thanks!
2009-05-20 16:24:04 +00:00
Thomas Dinges
20042dbba5 2.5 Buttons:
* New scene buttons layout.
* Minor changes in object buttons and scene RNA.
2009-05-17 09:25:30 +00:00
Brecht Van Lommel
b4d46e5ded UI: Layout Engine
* Buttons are now created first, and after that the layout is computed.
  This means the layout engine now works at button level, and makes it
  easier to write templates. Otherwise you had to store all info and
  create the buttons later.
* Added interface_templates.c as a separate file to put templates in.
  These can contain regular buttons, and can be put in a Free layout,
  which means you can specify manual coordinates, but still get nested
  correct inside other layouts.

* API was changed to allow better nesting. Previously items were added
  in the last added layout specifier, i.e. one level up in the layout
  hierarchy. This doesn't work well in always, so now when creating things
  like rows or columns it always returns a layout which you have to add
  the items in. All py scripts were updated to follow this.

* Computing the layout now goes in two passes, first estimating the
  required width/height of all nested layouts, and then in the second
  pass using the results of that to decide on the actual locations.

* Enum and array buttons now follow the direction of the layout, i.e.
  they are vertical or horizontal depending if they are in a column or row.
* Color properties now get a color picker, and only get the additional
  RGB sliders with Expand=True.
* File/directory string properties now get a button next to them for
  opening the file browse, though this is not implemented yet.
* Layout items can now be aligned, set align=True when creating a column,
  row, etc.
* Buttons now get a minimum width of one icon (avoids squashing icon
  buttons).

* Moved some more space variables into Style.
2009-05-15 11:19:59 +00:00
Brecht Van Lommel
58cdd37f52 UI:
* Made separator item work horizontal & vertical.
* Add colon (:) automatic for int/float/enum/string.
* Added space variables to uiStyle and use them in the
  layout engine.

* Added initial World buttons by Thomas Dinges, thanks!
* Added some code for modifiers in the Object Data context.
  This will become a template though.
* Use a common poll() callback in the scripts to reduce code.
2009-04-27 18:05:58 +00:00
Michael Fox
119d0e9145 Small comit, added the colour mode (BW,RGB,RGBA) and object type to rna, and added appropriate entries to the UI 2009-04-24 01:17:54 +00:00
Brecht Van Lommel
adff6aeb1c RNA: Generic Type Registration
The Python API to define Panels and Operators is based on subclassing,
this makes that system more generic, and based on RNA. Hopefully that
will make it easy to make various parts of Blender more extensible.

* The system simply uses RNA properties and functions and marks them
  with REGISTER to make them part of the type registration process.
  Additionally, the struct must provide a register/unregister callback
  to create/free the PanelType or similar.
* From the python side there were some small changes, mainly that
  registration now goes trough bpy.types.register instead of
  bpy.ui.addPanel.

* Only Panels have been wrapped this way now.  Check rna_ui.c to see
  how this code works. There's still some rough edges and possibilities
  to make it cleaner, though it works without any manual python code.
* Started some docs here:

http://wiki.blender.org/index.php/BlenderDev/Blender2.5/RNATypeRegistration

* Also changed some RNA_property and RNA_struct functions to not
  require a PointerRNA anymore, where they were not required (which
  is actually the cause of most changed files).
2009-04-19 13:37:59 +00:00
Brecht Van Lommel
26a8c63eae UI:
* Don't call generic layout hints templates anymore, i.e.
  TemplateRow becomes Row, etc.
* Added more general layout nesting, using uiLayoutSplit()
  and uiLayoutBox() functions, for which the sublayouts
  can then be accessed using uiLayoutSub(), to put items
  in those sublayouts.
* Some steps to make the layout decisions, like which items
  to put in which columns, independent of the width of the
  window or the text in the buttons. We want the layout to
  be stable under resizes and translations.
* Added an "expand" parameter to uiItemR, used now to expand
  enums into a row instead of using a menu.
2009-04-16 12:17:58 +00:00
Brecht Van Lommel
8b1207d500 UI:
* Converted scene buttons layout code to use python.
2009-04-15 15:10:31 +00:00
Campbell Barton
3f98b7ac35 Added back importing UI scripts rather then running,
The bug was todo with bpy.data and bpy.types becoming invalid, temporary fix is to re-assign them to the bpy module before running python operators or panels.
will look into a nicer way to get this working.
2009-04-11 16:17:39 +00:00
Campbell Barton
963e217c2a undo previous commit, changing running the script to importing it somehow made it crash when running the class functions. will look into this further. 2009-04-11 10:01:49 +00:00
Campbell Barton
9d922b4c24 Changed the script UI registration to import rather then run each python script,
this means it caches the compiled pyc files after importing fro the first time.

My times for importing 501 buttons_objects.py files were.
- running each as a script 1.9sec
- importing for the first time 1.8sec
- importing a second time (using pyc files) 0.57sec

Also added "bpy" to sys.modules so it can be imported.
2009-04-11 05:46:40 +00:00
Brecht Van Lommel
c7b587105f UI:
* Added very basic loading of .py files on startup to define panels.
  It now executes all .py files in .blender/ui on startup. Right now
  this contains the object buttons, the C code for it is commented out.

  These files should get embedded in the blender executable as well
  eventually, that's a bit more complicated so this works for now.

* For scons and cmake it seems to copy & find the files OK, for make
  only "make release" works (same with scripts/ folder it seems).

* Added BLI_gethome_folder function in BLI_util.h. This is adapted
  from bpy_gethome, and gives the path to a folder in .blender like
  scripts or ui.

There's plenty of things to figure out here about paths, embedding,
caching, user configs ...
2009-04-11 02:18:24 +00:00