189 Commits

Author SHA1 Message Date
Aaron Carlisle
2e52b3206c PyDoc: Fix warnings from out of bounds include statement 2020-06-02 18:21:42 -04:00
Aaron Carlisle
817c38f715 PyAPI Docs: Update aud example
Fixes T74641
2020-03-19 16:21:17 -04:00
Sybren A. Stüvel
2d5773d11a Documentation: added bpy.msgbus description and examples
The `bpy.msgbus` namespace was not included in the documentation generation.
I've added it, and ported Campbell's examples from P563.
2020-03-06 14:29:03 +01:00
Aaron Carlisle
ae223ff52b Addons: deprecate 'wiki_url'
When running with debug enabled ('-d' argument),
warnings are printed for add-ons which are not yet updated.

Reminder to name things based on what they do,
not the technologies they use :)
2020-03-05 11:45:22 +11:00
Sybren A. Stüvel
be8879718e Documentation: add note on altering data from frame change handlers
Blender can crash while rendering, when scene data is changed from within
a `frame_change_pre` or `frame_change_post` callback function. This results
in bug reports like T60094, T67627, and T73530. Until this is properly
resolved, this limitation should be documented.

No functional changes.
2020-02-11 11:00:12 +01:00
mano-wii
2ab5ca81a5 Fix T68413: gpu module example in docs produces unexpected results 2020-01-27 10:29:00 -03:00
Campbell Barton
61bf51acb5 Cleanup: pep8 for examples 2019-11-01 10:53:47 +11:00
Campbell Barton
c8c3e7d284 Cleanup: trailing space, remove tabs, pep8 2019-09-10 06:17:59 +10:00
Bastien Montagne
74ffcad90e PyAPI Doc: Fix presets menu example. 2019-06-26 15:35:34 +02:00
Bastien Montagne
0e327968a9 PyAPI Doc: Minor updates to UIList examples... 2019-06-26 15:06:18 +02:00
Campbell Barton
0c538fc923 Cleanup: spelling, grammar, and other corrections
D5084 by @nBurn with edits
2019-06-21 10:18:53 +10:00
Jacques Lucke
3a7af37e28 Python API Docs: fix some examples 2019-06-06 17:13:02 +02:00
Dalai Felinto
c01e43d024 Update Python GPU example to latest depsgraph API 2019-05-31 11:31:04 -03:00
Dalai Felinto
caf52e3779 Update "Overriding Context" API example 2019-05-24 19:21:30 -03:00
Brecht Van Lommel
49593a2c38 Fix T64528: error in RenderEngine API docs example 2019-05-23 10:33:11 +02:00
Sybren A. Stüvel
8022bd7059 Depsgraph examples: don't assign to names of built-in Python objects
`object` is the superclass of all objects. Old-style code could still be
using `class SomeClass(object)` and assigning something else to `object`
could have unexpected results.

This is now also documented in the
[Python style guide](https://wiki.blender.org/wiki/Style_Guide/Python)
on the wiki.

Differential Revision: https://developer.blender.org/D4922

Reviewed by: sergey
2019-05-23 10:29:49 +02:00
Brecht Van Lommel
6864d0b6f1 API Docs: fix mistake in example code 2019-05-17 10:43:31 +02:00
Brecht Van Lommel
32b5f24c2a API Docs: add example use cases for mesh functions, fix wrong description 2019-05-17 10:34:20 +02:00
Sergey Sharybin
5186cfbea4 Depsgraph: State behavior details more explicitly 2019-05-17 10:24:45 +02:00
Sergey Sharybin
2ee762344f Cycles: Fix missing viewport updates after recent changes
We can not access ensured-to-be-evaluated dependency graph from the
render API: some of it is running from within evaluation which makes
it possible for engines to access list of evaluated IDs.

Solved by passing dependency graph to viewport functions, similar to
the final render functions.
2019-05-16 17:24:16 +02:00
Sergey Sharybin
32d5d127cb Tweak API to support adding evaluated meshes to main database
One of the usecases is to create mesh from an object is a manner similar to
how Apply Modifiers does it, and have it in the bmain so it can be referenced
by other objects.

This usecase is something what went unnoticed in the previous API changes, so
here is a followup.

Summary of changes:

* bpy.meshes.new_from_object() behaves almost the same as before this change.
  The difference now is that it now ensures all referenced data-blocks are
	original (for example, materials referenced by the mesh).

* object.to_mesh() now creates free-standing Mesh data-block which is outside
  of any bmain. The object owns it, which guarantees the memory never leaks.

  It is possible to force free memory by calling object.to_mesh_clear().

Reviewers: brecht

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D4875
2019-05-16 16:42:16 +02:00
Sergey Sharybin
e693918d40 Dependency graph API changes
Main goal here is to make it obvious and predictable about
what is going on.

Summary of changes.

- Access to dependency graph is now only possible to a fully evaluated
  graph. This is now done via context.evaluated_depsgraph_get().

  The call will ensure both relations and datablocks are updated.

  This way we don't allow access to some known bad state of the graph,
  and also making explicit that getting update dependency graph is not
  cheap.

- Access to evaluated ID is now possible via id.evaluated_get().

  It was already possible to get evaluated ID via dependency graph,
  but that was a bit confusing why access to original is done via ID
  and to evaluated via depsgraph.

  If datablock is not covered by dependency graph it will be returned
  as-is.

- Similarly, request for original from an ID which is not evaluated
  will return ID as-is.

- Removed scene.update().

  This is very expensive to update all the view layers.

- Added depsgraph.update().

  Now when temporary changes to objects are to be done, this is to
  happen on original object and then dependency graph is to be
  updated.

- Changed object.to_mesh() to behave the following way:

   * When is used for original object modifiers are ignored.

     For meshes this acts similar to mesh-copy, not very useful but
     allows to keep code paths similar (i.e. for exporter which has
     Apply Modifiers option it's only matter choosing between original
     and evaluated object, the to_mesh() part can stay the same).

     For curves this gives a mesh which is constructed from displist
     without taking own modifiers and modifiers of bevel/taper objects
     into account.

     For metaballs this gives empty mesh.
     Polygonization of metaball is not possible from a single object.

   * When is used for evaluated object modifiers are always applied.

     In fact, no evaluation is happening, the mesh is either copied
     as-is, or constructed from current state of curve cache.

  Arguments to apply modifiers and calculate original coordinates (ORCO,
  aka undeformed coordinates) are removed. The ORCO is to be calculated
  as part of dependency graph evaluation.

File used to regression-test (a packed Python script into .blend):

{F7033464}

Patch to make addons tests to pass:

{F7033466}

NOTE: I've included changes to FBX exporter, and those are addressing
report T63689.

NOTE: All the enabled-by-default addons are to be ported still, but
first want to have agreement on this part of changes.

NOTE: Also need to work on documentation for Python API, but, again,
better be done after having agreement on this work.

Reviewers: brecht, campbellbarton, mont29

Differential Revision: https://developer.blender.org/D4834
2019-05-16 11:49:21 +02:00
Brecht Van Lommel
99c98aa306 Python API: tweak RenderEngine example to be a bit more efficient.
Suggested by Germano Cavalcante.
2019-03-27 16:25:19 +01:00
Brecht Van Lommel
337eb8c1de Python API: add more detailed example for RenderEngine. 2019-03-26 19:57:51 +01:00
Campbell Barton
dd1132416e Docs: update examples for 2.8x
Use fields for properties
2019-03-22 00:07:06 +11:00
Campbell Barton
ad9addbf46 Cleanup: unused imports 2019-03-17 21:00:56 +11:00
Campbell Barton
63fcbfc3a7 RNA: naming, user-preferences -> preferences 2018-12-21 12:55:02 +11:00
Campbell Barton
0ed4cadf5a Docs: use float in bpy.app.timer examples
Makes it clear seconds are not integers,
also avoids conversion to float.
2018-11-28 06:09:42 +11:00
Jacques Lucke
dcb86689b0 Python API Docs: Examples for new timer api 2018-11-27 11:31:48 +01:00
Campbell Barton
3c8c976086 Cleanup: gpu docs 2018-11-20 07:38:20 +11:00
Jacques Lucke
422992a135 Py API Docs: use new bind context manager in gpu examples 2018-11-19 14:32:51 +01:00
Jacques Lucke
78207eac9b Py API Docs: New custom shader example 2018-11-14 18:41:33 +01:00
Jacques Lucke
9caa587519 Py API Docs: Remove older GPUOffScreen example
I think this example does not belong into the api docs and certainly not in the place where it was until now.
Maybe this can become a template in Blender but personally I don't see much value in it as an "official example" because it is hard to see what is going on exactly.
There are a few other examples that show how to use the GPUOffScreen object now.
2018-11-13 16:43:17 +01:00
Jacques Lucke
3aa30406dd Py API Docs: New Example for off screen rendering 2018-11-13 16:38:12 +01:00
Jacques Lucke
15a5cc6ca0 Py API Docs: another use case for offscreen rendering 2018-11-12 17:54:51 +01:00
Jacques Lucke
406452ec5d Py API Docs: Another example for offscreen rendering 2018-11-12 17:17:59 +01:00
Jacques Lucke
ded780f13e Py API Docs: fix typos/wording
found by Omar Ahmad
2018-11-12 13:48:31 +01:00
Jacques Lucke
492dbae4d1 Py API Docs: Restructure gpu module introduction 2018-11-12 12:14:18 +01:00
Jacques Lucke
a4bfccc439 Py API Docs: More gpu module documentation 2018-11-09 19:20:55 +01:00
Dalai Felinto
49a7bcafd9 gpu.offscreen, fix pydoc, example and rename modelviewmatrix > viewmatrix
Technically this is only the view matrix, not model view matrix.
And view layer was missing from the pydoc.
2018-11-09 13:54:38 -02:00
Campbell Barton
f12d2adc87 RNA: Object.select_set use boolean, only select
- Was setting active state, making it necessary to backup/restore
  active object in cases where this isn't needed.
  Existing scripts are explicitly setting the active object when needed.

- Use a boolean select arg (toggle selection wasn't used anywhere).

- Add an optional view layer argument since scripts should be able to
  operate outside the user context.
2018-11-08 08:54:55 +11:00
Jacques Lucke
b82eac8986 Py API Docs: improve 2D image example 2018-11-07 16:14:11 +01:00
Bastien Montagne
7b38df41ae Fix/cleanup RNA viewlayer API.
RNA's ViewLayer would present 'first level' of layer collection as a
list (collection property), when it is actually now only a single item,
same as the scene's master collection.

Note: did not try to update view_layer python tests, those are already
fully broken for quiet some time I guess (they still assume
view_layer.collections to be mutable e.g.)...
2018-11-06 17:20:49 +01:00
Bastien Montagne
a22167b9a2 Fix/Updated Object API example.
Was still 2.7x code... ;)
2018-11-05 20:42:00 +01:00
Jacques Lucke
a8e9959e07 API Docs: gpu api introduction + examples 2018-11-05 19:28:28 +01:00
Campbell Barton
ca8fee62ab Update gpu offscreen PyAPI example 2018-10-26 12:13:03 +11:00
Campbell Barton
6ebe211644 Cleanup: pep8 2018-09-27 09:41:18 +10:00
Dalai Felinto
a3020d5558 Fixup for gpu.types.GPUOffscreen.py example
Addressing the changes introduced on: 43fa51835adee390aa4bcb9fe3bda1034480b7cf
2018-09-21 13:34:53 -03:00
mano-wii
43fa51835a gpu.types.GPUOffscreen.py example file: Move the shader reference removal code to execute on __main__ 2018-09-21 13:26:23 -03:00
mano-wii
964bb28e21 gpu.types.GPUOffscreen.py example file: Delete the reference of the previous shader.
Strange that the `bpy.utils.register_class` utility does not remove the reference of the class with same name.
2018-09-21 12:36:38 -03:00