2011-02-23 10:52:22 +00:00
|
|
|
/*
|
2009-06-18 19:48:55 +00:00
|
|
|
* ***** BEGIN GPL LICENSE BLOCK *****
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
2012-03-18 09:27:36 +00:00
|
|
|
* of the License, or (at your option) any later version.
|
2009-06-18 19:48:55 +00:00
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software Foundation,
|
2010-02-12 13:34:04 +00:00
|
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2009-06-18 19:48:55 +00:00
|
|
|
*
|
|
|
|
* The Original Code is Copyright (C) 2009 Blender Foundation.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
2012-03-18 09:27:36 +00:00
|
|
|
*
|
2009-06-18 19:48:55 +00:00
|
|
|
* Contributor(s): Blender Foundation
|
|
|
|
*
|
|
|
|
* ***** END GPL LICENSE BLOCK *****
|
|
|
|
*/
|
|
|
|
|
2011-02-27 20:20:01 +00:00
|
|
|
/** \file blender/makesrna/intern/rna_object_api.c
|
|
|
|
* \ingroup RNA
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
2009-06-18 19:48:55 +00:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdio.h>
|
2009-06-24 19:23:34 +00:00
|
|
|
#include <string.h>
|
|
|
|
#include <time.h>
|
2009-06-18 19:48:55 +00:00
|
|
|
|
2013-02-10 13:44:18 +00:00
|
|
|
#include "BLI_utildefines.h"
|
2016-01-12 09:37:56 +01:00
|
|
|
#include "BLI_kdopbvh.h"
|
2013-02-10 13:44:18 +00:00
|
|
|
|
2009-06-18 19:48:55 +00:00
|
|
|
#include "RNA_define.h"
|
|
|
|
|
2012-12-28 13:21:57 +00:00
|
|
|
#include "DNA_constraint_types.h"
|
Render Layers and Collections (merge from render-layers)
Design Documents
----------------
* https://wiki.blender.org/index.php/Dev:2.8/Source/Layers
* https://wiki.blender.org/index.php/Dev:2.8/Source/DataDesignRevised
User Commit Log
---------------
* New Layer and Collection system to replace render layers and viewport layers.
* A layer is a set of collections of objects (and their drawing options) required for specific tasks.
* A collection is a set of objects, equivalent of the old layers in Blender. A collection can be shared across multiple layers.
* All Scenes have a master collection that all other collections are children of.
* New collection "context" tab (in Properties Editor)
* New temporary viewport "collections" panel to control per-collection
visibility
Missing User Features
---------------------
* Collection "Filter"
Option to add objects based on their names
* Collection Manager operators
The existing buttons are placeholders
* Collection Manager drawing
The editor main region is empty
* Collection Override
* Per-Collection engine settings
This will come as a separate commit, as part of the clay-engine branch
Dev Commit Log
--------------
* New DNA file (DNA_layer_types.h) with the new structs
We are replacing Base by a new extended Base while keeping it backward
compatible with some legacy settings (i.e., lay, flag_legacy).
Renamed all Base to BaseLegacy to make it clear the areas of code that
still need to be converted
Note: manual changes were required on - deg_builder_nodes.h, rna_object.c, KX_Light.cpp
* Unittesting for main syncronization requirements
- read, write, add/copy/remove objects, copy scene, collection
link/unlinking, context)
* New Editor: Collection Manager
Based on patch by Julian Eisel
This is extracted from the layer-manager branch. With the following changes:
- Renamed references of layer manager to collections manager
- I doesn't include the editors/space_collections/ draw and util files
- The drawing code itself will be implemented separately by Julian
* Base / Object:
A little note about them. Original Blender code would try to keep them
in sync through the code, juggling flags back and forth. This will now
be handled by Depsgraph, keeping Object and Bases more separated
throughout the non-rendering code.
Scene.base is being cleared in doversion, and the old viewport drawing
code was poorly converted to use the new bases while the new viewport
code doesn't get merged and replace the old one.
Python API Changes
------------------
```
- scene.layers
+ # no longer exists
- scene.objects
+ scene.scene_layers.active.objects
- scene.objects.active
+ scene.render_layers.active.objects.active
- bpy.context.scene.objects.link()
+ bpy.context.scene_collection.objects.link()
- bpy_extras.object_utils.object_data_add(context, obdata, operator=None, use_active_layer=True, name=None)
+ bpy_extras.object_utils.object_data_add(context, obdata, operator=None, name=None)
- bpy.context.object.select
+ bpy.context.object.select = True
+ bpy.context.object.select = False
+ bpy.context.object.select_get()
+ bpy.context.object.select_set(action='SELECT')
+ bpy.context.object.select_set(action='DESELECT')
-AddObjectHelper.layers
+ # no longer exists
```
2017-02-07 10:18:38 +01:00
|
|
|
#include "DNA_layer_types.h"
|
2011-03-16 08:53:35 +00:00
|
|
|
#include "DNA_modifier_types.h"
|
2012-12-28 13:21:57 +00:00
|
|
|
#include "DNA_object_types.h"
|
2009-06-20 16:32:52 +00:00
|
|
|
|
Render Layers and Collections (merge from render-layers)
Design Documents
----------------
* https://wiki.blender.org/index.php/Dev:2.8/Source/Layers
* https://wiki.blender.org/index.php/Dev:2.8/Source/DataDesignRevised
User Commit Log
---------------
* New Layer and Collection system to replace render layers and viewport layers.
* A layer is a set of collections of objects (and their drawing options) required for specific tasks.
* A collection is a set of objects, equivalent of the old layers in Blender. A collection can be shared across multiple layers.
* All Scenes have a master collection that all other collections are children of.
* New collection "context" tab (in Properties Editor)
* New temporary viewport "collections" panel to control per-collection
visibility
Missing User Features
---------------------
* Collection "Filter"
Option to add objects based on their names
* Collection Manager operators
The existing buttons are placeholders
* Collection Manager drawing
The editor main region is empty
* Collection Override
* Per-Collection engine settings
This will come as a separate commit, as part of the clay-engine branch
Dev Commit Log
--------------
* New DNA file (DNA_layer_types.h) with the new structs
We are replacing Base by a new extended Base while keeping it backward
compatible with some legacy settings (i.e., lay, flag_legacy).
Renamed all Base to BaseLegacy to make it clear the areas of code that
still need to be converted
Note: manual changes were required on - deg_builder_nodes.h, rna_object.c, KX_Light.cpp
* Unittesting for main syncronization requirements
- read, write, add/copy/remove objects, copy scene, collection
link/unlinking, context)
* New Editor: Collection Manager
Based on patch by Julian Eisel
This is extracted from the layer-manager branch. With the following changes:
- Renamed references of layer manager to collections manager
- I doesn't include the editors/space_collections/ draw and util files
- The drawing code itself will be implemented separately by Julian
* Base / Object:
A little note about them. Original Blender code would try to keep them
in sync through the code, juggling flags back and forth. This will now
be handled by Depsgraph, keeping Object and Bases more separated
throughout the non-rendering code.
Scene.base is being cleared in doversion, and the old viewport drawing
code was poorly converted to use the new bases while the new viewport
code doesn't get merged and replace the old one.
Python API Changes
------------------
```
- scene.layers
+ # no longer exists
- scene.objects
+ scene.scene_layers.active.objects
- scene.objects.active
+ scene.render_layers.active.objects.active
- bpy.context.scene.objects.link()
+ bpy.context.scene_collection.objects.link()
- bpy_extras.object_utils.object_data_add(context, obdata, operator=None, use_active_layer=True, name=None)
+ bpy_extras.object_utils.object_data_add(context, obdata, operator=None, name=None)
- bpy.context.object.select
+ bpy.context.object.select = True
+ bpy.context.object.select = False
+ bpy.context.object.select_get()
+ bpy.context.object.select_set(action='SELECT')
+ bpy.context.object.select_set(action='DESELECT')
-AddObjectHelper.layers
+ # no longer exists
```
2017-02-07 10:18:38 +01:00
|
|
|
#include "BKE_layer.h"
|
2014-07-07 10:50:43 +02:00
|
|
|
|
2017-04-06 15:37:46 +02:00
|
|
|
#include "DEG_depsgraph.h"
|
|
|
|
|
2012-09-22 14:07:55 +00:00
|
|
|
#include "rna_internal.h" /* own include */
|
|
|
|
|
2017-10-18 15:07:26 +11:00
|
|
|
static const EnumPropertyItem space_items[] = {
|
2012-12-28 13:21:57 +00:00
|
|
|
{CONSTRAINT_SPACE_WORLD, "WORLD", 0, "World Space",
|
|
|
|
"The most gobal space in Blender"},
|
|
|
|
{CONSTRAINT_SPACE_POSE, "POSE", 0, "Pose Space",
|
|
|
|
"The pose space of a bone (its armature's object space)"},
|
|
|
|
{CONSTRAINT_SPACE_PARLOCAL, "LOCAL_WITH_PARENT", 0, "Local With Parent",
|
|
|
|
"The local space of a bone's parent bone"},
|
|
|
|
{CONSTRAINT_SPACE_LOCAL, "LOCAL", 0, "Local Space",
|
|
|
|
"The local space of an object/bone"},
|
|
|
|
{0, NULL, 0, NULL, NULL}
|
|
|
|
};
|
|
|
|
|
2009-06-18 19:48:55 +00:00
|
|
|
#ifdef RNA_RUNTIME
|
2012-12-28 13:21:57 +00:00
|
|
|
|
2011-08-04 13:22:38 +00:00
|
|
|
#include "BLI_math.h"
|
2009-06-18 19:48:55 +00:00
|
|
|
|
2012-12-28 13:21:57 +00:00
|
|
|
#include "BKE_anim.h"
|
2010-01-02 15:31:02 +00:00
|
|
|
#include "BKE_bvhutils.h"
|
2012-12-28 13:21:57 +00:00
|
|
|
#include "BKE_cdderivedmesh.h"
|
|
|
|
#include "BKE_constraint.h"
|
|
|
|
#include "BKE_context.h"
|
2009-06-18 19:48:55 +00:00
|
|
|
#include "BKE_customdata.h"
|
2009-07-16 13:19:43 +00:00
|
|
|
#include "BKE_font.h"
|
2012-12-28 13:21:57 +00:00
|
|
|
#include "BKE_global.h"
|
|
|
|
#include "BKE_main.h"
|
|
|
|
#include "BKE_mesh.h"
|
2009-09-16 15:55:00 +00:00
|
|
|
#include "BKE_mball.h"
|
2010-11-12 15:05:57 +00:00
|
|
|
#include "BKE_modifier.h"
|
2012-12-28 13:21:57 +00:00
|
|
|
#include "BKE_object.h"
|
|
|
|
#include "BKE_report.h"
|
2009-07-16 13:19:43 +00:00
|
|
|
|
2013-03-21 16:06:46 +00:00
|
|
|
#include "ED_object.h"
|
|
|
|
|
2012-12-28 13:21:57 +00:00
|
|
|
#include "DNA_curve_types.h"
|
2009-06-18 19:48:55 +00:00
|
|
|
#include "DNA_mesh_types.h"
|
2009-06-20 16:32:52 +00:00
|
|
|
#include "DNA_meshdata_types.h"
|
2012-12-28 13:21:57 +00:00
|
|
|
#include "DNA_scene_types.h"
|
2010-05-23 12:14:07 +00:00
|
|
|
#include "DNA_view3d_types.h"
|
2009-06-18 19:48:55 +00:00
|
|
|
|
2009-07-16 13:19:43 +00:00
|
|
|
#include "MEM_guardedalloc.h"
|
2009-06-18 19:48:55 +00:00
|
|
|
|
Render Layers and Collections (merge from render-layers)
Design Documents
----------------
* https://wiki.blender.org/index.php/Dev:2.8/Source/Layers
* https://wiki.blender.org/index.php/Dev:2.8/Source/DataDesignRevised
User Commit Log
---------------
* New Layer and Collection system to replace render layers and viewport layers.
* A layer is a set of collections of objects (and their drawing options) required for specific tasks.
* A collection is a set of objects, equivalent of the old layers in Blender. A collection can be shared across multiple layers.
* All Scenes have a master collection that all other collections are children of.
* New collection "context" tab (in Properties Editor)
* New temporary viewport "collections" panel to control per-collection
visibility
Missing User Features
---------------------
* Collection "Filter"
Option to add objects based on their names
* Collection Manager operators
The existing buttons are placeholders
* Collection Manager drawing
The editor main region is empty
* Collection Override
* Per-Collection engine settings
This will come as a separate commit, as part of the clay-engine branch
Dev Commit Log
--------------
* New DNA file (DNA_layer_types.h) with the new structs
We are replacing Base by a new extended Base while keeping it backward
compatible with some legacy settings (i.e., lay, flag_legacy).
Renamed all Base to BaseLegacy to make it clear the areas of code that
still need to be converted
Note: manual changes were required on - deg_builder_nodes.h, rna_object.c, KX_Light.cpp
* Unittesting for main syncronization requirements
- read, write, add/copy/remove objects, copy scene, collection
link/unlinking, context)
* New Editor: Collection Manager
Based on patch by Julian Eisel
This is extracted from the layer-manager branch. With the following changes:
- Renamed references of layer manager to collections manager
- I doesn't include the editors/space_collections/ draw and util files
- The drawing code itself will be implemented separately by Julian
* Base / Object:
A little note about them. Original Blender code would try to keep them
in sync through the code, juggling flags back and forth. This will now
be handled by Depsgraph, keeping Object and Bases more separated
throughout the non-rendering code.
Scene.base is being cleared in doversion, and the old viewport drawing
code was poorly converted to use the new bases while the new viewport
code doesn't get merged and replace the old one.
Python API Changes
------------------
```
- scene.layers
+ # no longer exists
- scene.objects
+ scene.scene_layers.active.objects
- scene.objects.active
+ scene.render_layers.active.objects.active
- bpy.context.scene.objects.link()
+ bpy.context.scene_collection.objects.link()
- bpy_extras.object_utils.object_data_add(context, obdata, operator=None, use_active_layer=True, name=None)
+ bpy_extras.object_utils.object_data_add(context, obdata, operator=None, name=None)
- bpy.context.object.select
+ bpy.context.object.select = True
+ bpy.context.object.select = False
+ bpy.context.object.select_get()
+ bpy.context.object.select_set(action='SELECT')
+ bpy.context.object.select_set(action='DESELECT')
-AddObjectHelper.layers
+ # no longer exists
```
2017-02-07 10:18:38 +01:00
|
|
|
static void rna_Object_select_set(Object *ob, bContext *C, ReportList *reports, int action)
|
|
|
|
{
|
2017-11-22 10:52:39 -02:00
|
|
|
ViewLayer *view_layer = CTX_data_view_layer(C);
|
|
|
|
Base *base = BKE_view_layer_base_find(view_layer, ob);
|
Render Layers and Collections (merge from render-layers)
Design Documents
----------------
* https://wiki.blender.org/index.php/Dev:2.8/Source/Layers
* https://wiki.blender.org/index.php/Dev:2.8/Source/DataDesignRevised
User Commit Log
---------------
* New Layer and Collection system to replace render layers and viewport layers.
* A layer is a set of collections of objects (and their drawing options) required for specific tasks.
* A collection is a set of objects, equivalent of the old layers in Blender. A collection can be shared across multiple layers.
* All Scenes have a master collection that all other collections are children of.
* New collection "context" tab (in Properties Editor)
* New temporary viewport "collections" panel to control per-collection
visibility
Missing User Features
---------------------
* Collection "Filter"
Option to add objects based on their names
* Collection Manager operators
The existing buttons are placeholders
* Collection Manager drawing
The editor main region is empty
* Collection Override
* Per-Collection engine settings
This will come as a separate commit, as part of the clay-engine branch
Dev Commit Log
--------------
* New DNA file (DNA_layer_types.h) with the new structs
We are replacing Base by a new extended Base while keeping it backward
compatible with some legacy settings (i.e., lay, flag_legacy).
Renamed all Base to BaseLegacy to make it clear the areas of code that
still need to be converted
Note: manual changes were required on - deg_builder_nodes.h, rna_object.c, KX_Light.cpp
* Unittesting for main syncronization requirements
- read, write, add/copy/remove objects, copy scene, collection
link/unlinking, context)
* New Editor: Collection Manager
Based on patch by Julian Eisel
This is extracted from the layer-manager branch. With the following changes:
- Renamed references of layer manager to collections manager
- I doesn't include the editors/space_collections/ draw and util files
- The drawing code itself will be implemented separately by Julian
* Base / Object:
A little note about them. Original Blender code would try to keep them
in sync through the code, juggling flags back and forth. This will now
be handled by Depsgraph, keeping Object and Bases more separated
throughout the non-rendering code.
Scene.base is being cleared in doversion, and the old viewport drawing
code was poorly converted to use the new bases while the new viewport
code doesn't get merged and replace the old one.
Python API Changes
------------------
```
- scene.layers
+ # no longer exists
- scene.objects
+ scene.scene_layers.active.objects
- scene.objects.active
+ scene.render_layers.active.objects.active
- bpy.context.scene.objects.link()
+ bpy.context.scene_collection.objects.link()
- bpy_extras.object_utils.object_data_add(context, obdata, operator=None, use_active_layer=True, name=None)
+ bpy_extras.object_utils.object_data_add(context, obdata, operator=None, name=None)
- bpy.context.object.select
+ bpy.context.object.select = True
+ bpy.context.object.select = False
+ bpy.context.object.select_get()
+ bpy.context.object.select_set(action='SELECT')
+ bpy.context.object.select_set(action='DESELECT')
-AddObjectHelper.layers
+ # no longer exists
```
2017-02-07 10:18:38 +01:00
|
|
|
|
|
|
|
if (!base) {
|
2017-11-22 10:52:39 -02:00
|
|
|
BKE_reportf(reports, RPT_ERROR, "Object '%s' not in Render Layer '%s'!", ob->id.name + 2, view_layer->name);
|
Render Layers and Collections (merge from render-layers)
Design Documents
----------------
* https://wiki.blender.org/index.php/Dev:2.8/Source/Layers
* https://wiki.blender.org/index.php/Dev:2.8/Source/DataDesignRevised
User Commit Log
---------------
* New Layer and Collection system to replace render layers and viewport layers.
* A layer is a set of collections of objects (and their drawing options) required for specific tasks.
* A collection is a set of objects, equivalent of the old layers in Blender. A collection can be shared across multiple layers.
* All Scenes have a master collection that all other collections are children of.
* New collection "context" tab (in Properties Editor)
* New temporary viewport "collections" panel to control per-collection
visibility
Missing User Features
---------------------
* Collection "Filter"
Option to add objects based on their names
* Collection Manager operators
The existing buttons are placeholders
* Collection Manager drawing
The editor main region is empty
* Collection Override
* Per-Collection engine settings
This will come as a separate commit, as part of the clay-engine branch
Dev Commit Log
--------------
* New DNA file (DNA_layer_types.h) with the new structs
We are replacing Base by a new extended Base while keeping it backward
compatible with some legacy settings (i.e., lay, flag_legacy).
Renamed all Base to BaseLegacy to make it clear the areas of code that
still need to be converted
Note: manual changes were required on - deg_builder_nodes.h, rna_object.c, KX_Light.cpp
* Unittesting for main syncronization requirements
- read, write, add/copy/remove objects, copy scene, collection
link/unlinking, context)
* New Editor: Collection Manager
Based on patch by Julian Eisel
This is extracted from the layer-manager branch. With the following changes:
- Renamed references of layer manager to collections manager
- I doesn't include the editors/space_collections/ draw and util files
- The drawing code itself will be implemented separately by Julian
* Base / Object:
A little note about them. Original Blender code would try to keep them
in sync through the code, juggling flags back and forth. This will now
be handled by Depsgraph, keeping Object and Bases more separated
throughout the non-rendering code.
Scene.base is being cleared in doversion, and the old viewport drawing
code was poorly converted to use the new bases while the new viewport
code doesn't get merged and replace the old one.
Python API Changes
------------------
```
- scene.layers
+ # no longer exists
- scene.objects
+ scene.scene_layers.active.objects
- scene.objects.active
+ scene.render_layers.active.objects.active
- bpy.context.scene.objects.link()
+ bpy.context.scene_collection.objects.link()
- bpy_extras.object_utils.object_data_add(context, obdata, operator=None, use_active_layer=True, name=None)
+ bpy_extras.object_utils.object_data_add(context, obdata, operator=None, name=None)
- bpy.context.object.select
+ bpy.context.object.select = True
+ bpy.context.object.select = False
+ bpy.context.object.select_get()
+ bpy.context.object.select_set(action='SELECT')
+ bpy.context.object.select_set(action='DESELECT')
-AddObjectHelper.layers
+ # no longer exists
```
2017-02-07 10:18:38 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (action == 2) { /* TOGGLE */
|
|
|
|
if ((base->flag & BASE_SELECTED) != 0) {
|
|
|
|
action = 1; /* DESELECT */
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
action = 0; /* SELECT */
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (action) {
|
2017-10-07 15:57:14 +11:00
|
|
|
case 1: /* DESELECT */
|
|
|
|
base->flag &= ~BASE_SELECTED;
|
|
|
|
break;
|
|
|
|
case 0: /* SELECT */
|
|
|
|
default:
|
2017-11-22 10:52:39 -02:00
|
|
|
BKE_view_layer_base_select(view_layer, base);
|
2017-10-07 15:57:14 +11:00
|
|
|
break;
|
Render Layers and Collections (merge from render-layers)
Design Documents
----------------
* https://wiki.blender.org/index.php/Dev:2.8/Source/Layers
* https://wiki.blender.org/index.php/Dev:2.8/Source/DataDesignRevised
User Commit Log
---------------
* New Layer and Collection system to replace render layers and viewport layers.
* A layer is a set of collections of objects (and their drawing options) required for specific tasks.
* A collection is a set of objects, equivalent of the old layers in Blender. A collection can be shared across multiple layers.
* All Scenes have a master collection that all other collections are children of.
* New collection "context" tab (in Properties Editor)
* New temporary viewport "collections" panel to control per-collection
visibility
Missing User Features
---------------------
* Collection "Filter"
Option to add objects based on their names
* Collection Manager operators
The existing buttons are placeholders
* Collection Manager drawing
The editor main region is empty
* Collection Override
* Per-Collection engine settings
This will come as a separate commit, as part of the clay-engine branch
Dev Commit Log
--------------
* New DNA file (DNA_layer_types.h) with the new structs
We are replacing Base by a new extended Base while keeping it backward
compatible with some legacy settings (i.e., lay, flag_legacy).
Renamed all Base to BaseLegacy to make it clear the areas of code that
still need to be converted
Note: manual changes were required on - deg_builder_nodes.h, rna_object.c, KX_Light.cpp
* Unittesting for main syncronization requirements
- read, write, add/copy/remove objects, copy scene, collection
link/unlinking, context)
* New Editor: Collection Manager
Based on patch by Julian Eisel
This is extracted from the layer-manager branch. With the following changes:
- Renamed references of layer manager to collections manager
- I doesn't include the editors/space_collections/ draw and util files
- The drawing code itself will be implemented separately by Julian
* Base / Object:
A little note about them. Original Blender code would try to keep them
in sync through the code, juggling flags back and forth. This will now
be handled by Depsgraph, keeping Object and Bases more separated
throughout the non-rendering code.
Scene.base is being cleared in doversion, and the old viewport drawing
code was poorly converted to use the new bases while the new viewport
code doesn't get merged and replace the old one.
Python API Changes
------------------
```
- scene.layers
+ # no longer exists
- scene.objects
+ scene.scene_layers.active.objects
- scene.objects.active
+ scene.render_layers.active.objects.active
- bpy.context.scene.objects.link()
+ bpy.context.scene_collection.objects.link()
- bpy_extras.object_utils.object_data_add(context, obdata, operator=None, use_active_layer=True, name=None)
+ bpy_extras.object_utils.object_data_add(context, obdata, operator=None, name=None)
- bpy.context.object.select
+ bpy.context.object.select = True
+ bpy.context.object.select = False
+ bpy.context.object.select_get()
+ bpy.context.object.select_set(action='SELECT')
+ bpy.context.object.select_set(action='DESELECT')
-AddObjectHelper.layers
+ # no longer exists
```
2017-02-07 10:18:38 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static int rna_Object_select_get(Object *ob, bContext *C, ReportList *reports)
|
|
|
|
{
|
2017-11-22 10:52:39 -02:00
|
|
|
ViewLayer *view_layer = CTX_data_view_layer(C);
|
|
|
|
Base *base = BKE_view_layer_base_find(view_layer, ob);
|
Render Layers and Collections (merge from render-layers)
Design Documents
----------------
* https://wiki.blender.org/index.php/Dev:2.8/Source/Layers
* https://wiki.blender.org/index.php/Dev:2.8/Source/DataDesignRevised
User Commit Log
---------------
* New Layer and Collection system to replace render layers and viewport layers.
* A layer is a set of collections of objects (and their drawing options) required for specific tasks.
* A collection is a set of objects, equivalent of the old layers in Blender. A collection can be shared across multiple layers.
* All Scenes have a master collection that all other collections are children of.
* New collection "context" tab (in Properties Editor)
* New temporary viewport "collections" panel to control per-collection
visibility
Missing User Features
---------------------
* Collection "Filter"
Option to add objects based on their names
* Collection Manager operators
The existing buttons are placeholders
* Collection Manager drawing
The editor main region is empty
* Collection Override
* Per-Collection engine settings
This will come as a separate commit, as part of the clay-engine branch
Dev Commit Log
--------------
* New DNA file (DNA_layer_types.h) with the new structs
We are replacing Base by a new extended Base while keeping it backward
compatible with some legacy settings (i.e., lay, flag_legacy).
Renamed all Base to BaseLegacy to make it clear the areas of code that
still need to be converted
Note: manual changes were required on - deg_builder_nodes.h, rna_object.c, KX_Light.cpp
* Unittesting for main syncronization requirements
- read, write, add/copy/remove objects, copy scene, collection
link/unlinking, context)
* New Editor: Collection Manager
Based on patch by Julian Eisel
This is extracted from the layer-manager branch. With the following changes:
- Renamed references of layer manager to collections manager
- I doesn't include the editors/space_collections/ draw and util files
- The drawing code itself will be implemented separately by Julian
* Base / Object:
A little note about them. Original Blender code would try to keep them
in sync through the code, juggling flags back and forth. This will now
be handled by Depsgraph, keeping Object and Bases more separated
throughout the non-rendering code.
Scene.base is being cleared in doversion, and the old viewport drawing
code was poorly converted to use the new bases while the new viewport
code doesn't get merged and replace the old one.
Python API Changes
------------------
```
- scene.layers
+ # no longer exists
- scene.objects
+ scene.scene_layers.active.objects
- scene.objects.active
+ scene.render_layers.active.objects.active
- bpy.context.scene.objects.link()
+ bpy.context.scene_collection.objects.link()
- bpy_extras.object_utils.object_data_add(context, obdata, operator=None, use_active_layer=True, name=None)
+ bpy_extras.object_utils.object_data_add(context, obdata, operator=None, name=None)
- bpy.context.object.select
+ bpy.context.object.select = True
+ bpy.context.object.select = False
+ bpy.context.object.select_get()
+ bpy.context.object.select_set(action='SELECT')
+ bpy.context.object.select_set(action='DESELECT')
-AddObjectHelper.layers
+ # no longer exists
```
2017-02-07 10:18:38 +01:00
|
|
|
|
|
|
|
if (!base) {
|
2017-11-22 10:52:39 -02:00
|
|
|
BKE_reportf(reports, RPT_ERROR, "Object '%s' not in Render Layer '%s'!", ob->id.name + 2, view_layer->name);
|
Render Layers and Collections (merge from render-layers)
Design Documents
----------------
* https://wiki.blender.org/index.php/Dev:2.8/Source/Layers
* https://wiki.blender.org/index.php/Dev:2.8/Source/DataDesignRevised
User Commit Log
---------------
* New Layer and Collection system to replace render layers and viewport layers.
* A layer is a set of collections of objects (and their drawing options) required for specific tasks.
* A collection is a set of objects, equivalent of the old layers in Blender. A collection can be shared across multiple layers.
* All Scenes have a master collection that all other collections are children of.
* New collection "context" tab (in Properties Editor)
* New temporary viewport "collections" panel to control per-collection
visibility
Missing User Features
---------------------
* Collection "Filter"
Option to add objects based on their names
* Collection Manager operators
The existing buttons are placeholders
* Collection Manager drawing
The editor main region is empty
* Collection Override
* Per-Collection engine settings
This will come as a separate commit, as part of the clay-engine branch
Dev Commit Log
--------------
* New DNA file (DNA_layer_types.h) with the new structs
We are replacing Base by a new extended Base while keeping it backward
compatible with some legacy settings (i.e., lay, flag_legacy).
Renamed all Base to BaseLegacy to make it clear the areas of code that
still need to be converted
Note: manual changes were required on - deg_builder_nodes.h, rna_object.c, KX_Light.cpp
* Unittesting for main syncronization requirements
- read, write, add/copy/remove objects, copy scene, collection
link/unlinking, context)
* New Editor: Collection Manager
Based on patch by Julian Eisel
This is extracted from the layer-manager branch. With the following changes:
- Renamed references of layer manager to collections manager
- I doesn't include the editors/space_collections/ draw and util files
- The drawing code itself will be implemented separately by Julian
* Base / Object:
A little note about them. Original Blender code would try to keep them
in sync through the code, juggling flags back and forth. This will now
be handled by Depsgraph, keeping Object and Bases more separated
throughout the non-rendering code.
Scene.base is being cleared in doversion, and the old viewport drawing
code was poorly converted to use the new bases while the new viewport
code doesn't get merged and replace the old one.
Python API Changes
------------------
```
- scene.layers
+ # no longer exists
- scene.objects
+ scene.scene_layers.active.objects
- scene.objects.active
+ scene.render_layers.active.objects.active
- bpy.context.scene.objects.link()
+ bpy.context.scene_collection.objects.link()
- bpy_extras.object_utils.object_data_add(context, obdata, operator=None, use_active_layer=True, name=None)
+ bpy_extras.object_utils.object_data_add(context, obdata, operator=None, name=None)
- bpy.context.object.select
+ bpy.context.object.select = True
+ bpy.context.object.select = False
+ bpy.context.object.select_get()
+ bpy.context.object.select_set(action='SELECT')
+ bpy.context.object.select_set(action='DESELECT')
-AddObjectHelper.layers
+ # no longer exists
```
2017-02-07 10:18:38 +01:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
return ((base->flag & BASE_SELECTED) != 0) ? 1 : 0;
|
|
|
|
}
|
|
|
|
|
2017-02-17 12:57:12 +01:00
|
|
|
static int rna_Object_visible_get(Object *ob, bContext *C, ReportList *reports)
|
|
|
|
{
|
2017-11-22 10:52:39 -02:00
|
|
|
ViewLayer *view_layer = CTX_data_view_layer(C);
|
|
|
|
Base *base = BKE_view_layer_base_find(view_layer, ob);
|
2017-02-17 12:57:12 +01:00
|
|
|
|
|
|
|
if (!base) {
|
2017-11-22 10:52:39 -02:00
|
|
|
BKE_reportf(reports, RPT_ERROR, "Object '%s' not in Render Layer '%s'!", ob->id.name + 2, view_layer->name);
|
2017-02-17 12:57:12 +01:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
return ((base->flag & BASE_VISIBLED) != 0) ? 1 : 0;
|
|
|
|
}
|
|
|
|
|
2012-12-28 13:21:57 +00:00
|
|
|
/* Convert a given matrix from a space to another (using the object and/or a bone as reference). */
|
|
|
|
static void rna_Scene_mat_convert_space(Object *ob, ReportList *reports, bPoseChannel *pchan,
|
|
|
|
float *mat, float *mat_ret, int from, int to)
|
|
|
|
{
|
|
|
|
copy_m4_m4((float (*)[4])mat_ret, (float (*)[4])mat);
|
|
|
|
|
|
|
|
/* Error in case of invalid from/to values when pchan is NULL */
|
|
|
|
if (pchan == NULL) {
|
|
|
|
if (ELEM(from, CONSTRAINT_SPACE_POSE, CONSTRAINT_SPACE_PARLOCAL)) {
|
|
|
|
const char *identifier = NULL;
|
|
|
|
RNA_enum_identifier(space_items, from, &identifier);
|
|
|
|
BKE_reportf(reports, RPT_ERROR, "'from_space' '%s' is invalid when no pose bone is given!", identifier);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (ELEM(to, CONSTRAINT_SPACE_POSE, CONSTRAINT_SPACE_PARLOCAL)) {
|
|
|
|
const char *identifier = NULL;
|
|
|
|
RNA_enum_identifier(space_items, to, &identifier);
|
|
|
|
BKE_reportf(reports, RPT_ERROR, "'to_space' '%s' is invalid when no pose bone is given!", identifier);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-01-11 14:59:11 +01:00
|
|
|
BKE_constraint_mat_convertspace(ob, pchan, (float (*)[4])mat_ret, from, to, false);
|
2012-12-28 13:21:57 +00:00
|
|
|
}
|
|
|
|
|
2015-01-03 12:05:16 +01:00
|
|
|
static void rna_Object_calc_matrix_camera(
|
|
|
|
Object *ob, float mat_ret[16], int width, int height, float scalex, float scaley)
|
|
|
|
{
|
|
|
|
CameraParams params;
|
|
|
|
|
|
|
|
/* setup parameters */
|
|
|
|
BKE_camera_params_init(¶ms);
|
|
|
|
BKE_camera_params_from_object(¶ms, ob);
|
|
|
|
|
|
|
|
/* compute matrix, viewplane, .. */
|
|
|
|
BKE_camera_params_compute_viewplane(¶ms, width, height, scalex, scaley);
|
|
|
|
BKE_camera_params_compute_matrix(¶ms);
|
|
|
|
|
|
|
|
copy_m4_m4((float (*)[4])mat_ret, params.winmat);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void rna_Object_camera_fit_coords(
|
|
|
|
Object *ob, Scene *scene, int num_cos, float *cos, float co_ret[3], float *scale_ret)
|
|
|
|
{
|
2015-03-21 22:34:20 +11:00
|
|
|
BKE_camera_view_frame_fit_to_coords(scene, (const float (*)[3])cos, num_cos / 3, ob, co_ret, scale_ret);
|
2015-01-03 12:05:16 +01:00
|
|
|
}
|
|
|
|
|
2009-07-16 13:19:43 +00:00
|
|
|
/* copied from Mesh_getFromObject and adapted to RNA interface */
|
|
|
|
/* settings: 0 - preview, 1 - render */
|
2013-02-10 13:44:18 +00:00
|
|
|
static Mesh *rna_Object_to_mesh(
|
2017-11-22 10:52:39 -02:00
|
|
|
Object *ob, bContext *C, ReportList *reports, Scene *sce, ViewLayer *view_layer,
|
2013-05-05 05:56:41 +00:00
|
|
|
int apply_modifiers, int settings, int calc_tessface, int calc_undeformed)
|
2009-06-18 19:48:55 +00:00
|
|
|
{
|
2017-07-21 11:53:13 +02:00
|
|
|
Main *bmain = CTX_data_main(C);
|
|
|
|
|
2017-11-22 10:52:39 -02:00
|
|
|
return rna_Main_meshes_new_from_object(bmain, reports, sce, view_layer, ob, apply_modifiers, settings, calc_tessface, calc_undeformed);
|
2009-06-24 19:23:34 +00:00
|
|
|
}
|
2009-06-20 16:32:52 +00:00
|
|
|
|
2016-12-28 17:30:58 +01:00
|
|
|
/* mostly a copy from convertblender.c */
|
2017-07-21 11:53:13 +02:00
|
|
|
static void dupli_render_particle_set(EvaluationContext *eval_ctx, Scene *scene, Object *ob, int level, int enable)
|
2016-12-28 17:30:58 +01:00
|
|
|
{
|
|
|
|
/* ugly function, but we need to set particle systems to their render
|
|
|
|
* settings before calling object_duplilist, to get render level duplis */
|
|
|
|
Group *group;
|
|
|
|
GroupObject *go;
|
|
|
|
ParticleSystem *psys;
|
|
|
|
DerivedMesh *dm;
|
|
|
|
float mat[4][4];
|
|
|
|
|
|
|
|
unit_m4(mat);
|
|
|
|
|
|
|
|
if (level >= MAX_DUPLI_RECUR)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (ob->transflag & OB_DUPLIPARTS) {
|
|
|
|
for (psys = ob->particlesystem.first; psys; psys = psys->next) {
|
|
|
|
if (ELEM(psys->part->ren_as, PART_DRAW_OB, PART_DRAW_GR)) {
|
|
|
|
if (enable)
|
|
|
|
psys_render_set(ob, psys, mat, mat, 1, 1, 0.f);
|
|
|
|
else
|
|
|
|
psys_render_restore(ob, psys);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (enable) {
|
|
|
|
/* this is to make sure we get render level duplis in groups:
|
|
|
|
* the derivedmesh must be created before init_render_mesh,
|
|
|
|
* since object_duplilist does dupliparticles before that */
|
2017-07-21 11:53:13 +02:00
|
|
|
dm = mesh_create_derived_render(eval_ctx, scene, ob, CD_MASK_BAREMESH | CD_MASK_MLOOPUV | CD_MASK_MLOOPCOL);
|
2016-12-28 17:30:58 +01:00
|
|
|
dm->release(dm);
|
|
|
|
|
|
|
|
for (psys = ob->particlesystem.first; psys; psys = psys->next)
|
|
|
|
psys_get_modifier(ob, psys)->flag &= ~eParticleSystemFlag_psys_updated;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ob->dup_group == NULL) return;
|
|
|
|
group = ob->dup_group;
|
|
|
|
|
|
|
|
for (go = group->gobject.first; go; go = go->next)
|
2017-07-21 11:53:13 +02:00
|
|
|
dupli_render_particle_set(eval_ctx, scene, go->ob, level + 1, enable);
|
2016-12-28 17:30:58 +01:00
|
|
|
}
|
2009-06-19 10:40:18 +00:00
|
|
|
/* When no longer needed, duplilist should be freed with Object.free_duplilist */
|
2017-07-21 11:53:13 +02:00
|
|
|
static void rna_Object_create_duplilist(Object *ob, bContext *C, ReportList *reports, Scene *sce, int settings)
|
2009-06-19 10:40:18 +00:00
|
|
|
{
|
2016-12-28 17:30:58 +01:00
|
|
|
bool for_render = (settings == DAG_EVAL_RENDER);
|
Depsgraph: New dependency graph integration commit
This commit integrates the work done so far on the new dependency graph system,
where goal was to replace legacy depsgraph with the new one, supporting loads of
neat features like:
- More granular dependency relation nature, which solves issues with fake cycles
in the dependencies.
- Move towards all-animatable, by better integration of drivers into the system.
- Lay down some basis for upcoming copy-on-write, overrides and so on.
The new system is living side-by-side with the previous one and disabled by
default, so nothing will become suddenly broken. The way to enable new depsgraph
is to pass `--new-depsgraph` command line argument.
It's a bit early to consider the system production-ready, there are some TODOs
and issues were discovered during the merge period, they'll be addressed ASAP.
But it's important to merge, because it's the only way to attract artists to
really start testing this system.
There are number of assorted documents related on the design of the new system:
* http://wiki.blender.org/index.php/User:Aligorith/GSoC2013_Depsgraph#Design_Documents
* http://wiki.blender.org/index.php/User:Nazg-gul/DependencyGraph
There are also some user-related information online:
* http://code.blender.org/2015/02/blender-dependency-graph-branch-for-users/
* http://code.blender.org/2015/03/more-dependency-graph-tricks/
Kudos to everyone who was involved into the project:
- Joshua "Aligorith" Leung -- design specification, initial code
- Lukas "lukas_t" Toenne -- integrating code into blender, with further fixes
- Sergey "Sergey" "Sharybin" -- some mocking around, trying to wrap up the
project and so
- Bassam "slikdigit" Kurdali -- stressing the new system, reporting all the
issues and recording/writing documentation.
- Everyone else who i forgot to mention here :)
2015-05-12 15:05:57 +05:00
|
|
|
EvaluationContext eval_ctx;
|
2017-07-21 11:53:13 +02:00
|
|
|
|
|
|
|
CTX_data_eval_ctx(C, &eval_ctx);
|
|
|
|
|
|
|
|
eval_ctx.mode = settings;
|
2012-10-04 21:40:39 +00:00
|
|
|
|
2009-06-19 10:40:18 +00:00
|
|
|
if (!(ob->transflag & OB_DUPLI)) {
|
2011-09-19 13:23:58 +00:00
|
|
|
BKE_report(reports, RPT_ERROR, "Object does not have duplis");
|
2009-06-19 10:40:18 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2009-06-24 19:23:34 +00:00
|
|
|
/* free duplilist if a user forgets to */
|
2009-06-23 17:52:58 +00:00
|
|
|
if (ob->duplilist) {
|
2012-10-20 10:28:34 +00:00
|
|
|
BKE_report(reports, RPT_WARNING, "Object.dupli_list has not been freed");
|
2009-06-19 10:40:18 +00:00
|
|
|
|
2009-06-23 17:52:58 +00:00
|
|
|
free_object_duplilist(ob->duplilist);
|
2012-03-05 23:30:41 +00:00
|
|
|
ob->duplilist = NULL;
|
2009-06-19 10:40:18 +00:00
|
|
|
}
|
2016-12-28 17:30:58 +01:00
|
|
|
if (for_render)
|
2017-07-21 11:53:13 +02:00
|
|
|
dupli_render_particle_set(&eval_ctx, sce, ob, 0, 1);
|
2013-12-26 17:24:42 +06:00
|
|
|
ob->duplilist = object_duplilist(&eval_ctx, sce, ob);
|
2016-12-28 17:30:58 +01:00
|
|
|
if (for_render)
|
2017-07-21 11:53:13 +02:00
|
|
|
dupli_render_particle_set(&eval_ctx, sce, ob, 0, 0);
|
2009-06-19 12:46:51 +00:00
|
|
|
/* ob->duplilist should now be freed with Object.free_duplilist */
|
2009-06-19 10:40:18 +00:00
|
|
|
}
|
|
|
|
|
2012-10-22 17:34:16 +00:00
|
|
|
static void rna_Object_free_duplilist(Object *ob)
|
2009-06-19 10:40:18 +00:00
|
|
|
{
|
2009-06-20 20:08:11 +00:00
|
|
|
if (ob->duplilist) {
|
|
|
|
free_object_duplilist(ob->duplilist);
|
2012-03-05 23:30:41 +00:00
|
|
|
ob->duplilist = NULL;
|
2009-09-16 10:09:57 +00:00
|
|
|
}
|
2009-06-19 10:40:18 +00:00
|
|
|
}
|
|
|
|
|
2012-03-18 09:27:36 +00:00
|
|
|
static PointerRNA rna_Object_shape_key_add(Object *ob, bContext *C, ReportList *reports,
|
|
|
|
const char *name, int from_mix)
|
2009-12-28 18:03:04 +00:00
|
|
|
{
|
2012-03-05 23:30:41 +00:00
|
|
|
KeyBlock *kb = NULL;
|
2009-12-28 18:03:04 +00:00
|
|
|
|
2015-06-08 19:49:01 +10:00
|
|
|
if ((kb = BKE_object_shapekey_insert(ob, name, from_mix))) {
|
2010-01-06 12:19:46 +00:00
|
|
|
PointerRNA keyptr;
|
|
|
|
|
|
|
|
RNA_pointer_create((ID *)ob->data, &RNA_ShapeKey, kb, &keyptr);
|
2012-05-12 11:01:29 +00:00
|
|
|
WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob);
|
2010-01-06 12:19:46 +00:00
|
|
|
|
|
|
|
return keyptr;
|
2009-12-28 18:03:04 +00:00
|
|
|
}
|
|
|
|
else {
|
2012-10-20 10:28:34 +00:00
|
|
|
BKE_reportf(reports, RPT_ERROR, "Object '%s' does not support shapes", ob->id.name + 2);
|
2010-01-06 12:19:46 +00:00
|
|
|
return PointerRNA_NULL;
|
2009-12-28 18:03:04 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-06-08 19:49:01 +10:00
|
|
|
static void rna_Object_shape_key_remove(
|
|
|
|
Object *ob, Main *bmain, ReportList *reports,
|
|
|
|
PointerRNA *kb_ptr)
|
|
|
|
{
|
|
|
|
KeyBlock *kb = kb_ptr->data;
|
|
|
|
Key *key = BKE_key_from_object(ob);
|
|
|
|
|
|
|
|
if ((key == NULL) || BLI_findindex(&key->block, kb) == -1) {
|
|
|
|
BKE_reportf(reports, RPT_ERROR, "ShapeKey not found");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!BKE_object_shapekey_remove(bmain, ob, kb)) {
|
|
|
|
BKE_reportf(reports, RPT_ERROR, "Could not remove ShapeKey");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2017-06-08 10:14:53 +02:00
|
|
|
DEG_id_tag_update(&ob->id, OB_RECALC_DATA);
|
2015-06-08 19:49:01 +10:00
|
|
|
WM_main_add_notifier(NC_OBJECT | ND_DRAW, ob);
|
|
|
|
|
|
|
|
RNA_POINTER_INVALIDATE(kb_ptr);
|
|
|
|
}
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
#if 0
|
2012-03-18 09:27:36 +00:00
|
|
|
static void rna_Mesh_assign_verts_to_group(Object *ob, bDeformGroup *group, int *indices, int totindex,
|
|
|
|
float weight, int assignmode)
|
2009-07-01 18:23:11 +00:00
|
|
|
{
|
|
|
|
if (ob->type != OB_MESH) {
|
2012-10-20 10:28:34 +00:00
|
|
|
BKE_report(reports, RPT_ERROR, "Object should be of mesh type");
|
2009-07-01 18:23:11 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2012-05-12 11:01:29 +00:00
|
|
|
Mesh *me = (Mesh *)ob->data;
|
2011-12-14 21:08:08 +00:00
|
|
|
int group_index = BLI_findlink(&ob->defbase, group);
|
2009-07-01 18:23:11 +00:00
|
|
|
if (group_index == -1) {
|
2012-10-20 10:28:34 +00:00
|
|
|
BKE_report(reports, RPT_ERROR, "No vertex groups assigned to mesh");
|
2009-07-01 18:23:11 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (assignmode != WEIGHT_REPLACE && assignmode != WEIGHT_ADD && assignmode != WEIGHT_SUBTRACT) {
|
2012-04-29 17:55:54 +00:00
|
|
|
BKE_report(reports, RPT_ERROR, "Bad assignment mode");
|
2009-07-01 18:23:11 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
/* makes a set of dVerts corresponding to the mVerts */
|
2012-03-18 09:27:36 +00:00
|
|
|
if (!me->dvert)
|
2009-07-01 18:23:11 +00:00
|
|
|
create_dverts(&me->id);
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
/* loop list adding verts to group */
|
|
|
|
for (i = 0; i < totindex; i++) {
|
|
|
|
if (i < 0 || i >= me->totvert) {
|
2011-09-19 13:23:58 +00:00
|
|
|
BKE_report(reports, RPT_ERROR, "Bad vertex index in list");
|
2009-07-01 18:23:11 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
add_vert_defnr(ob, group_index, i, weight, assignmode);
|
|
|
|
}
|
|
|
|
}
|
2012-03-05 23:30:41 +00:00
|
|
|
#endif
|
2009-06-24 19:23:34 +00:00
|
|
|
|
2013-08-06 02:16:29 +00:00
|
|
|
/* don't call inside a loop */
|
2015-07-23 15:38:50 +10:00
|
|
|
static int dm_looptri_to_poly_index(DerivedMesh *dm, const MLoopTri *lt)
|
2013-08-06 02:16:29 +00:00
|
|
|
{
|
2015-07-23 15:38:50 +10:00
|
|
|
const int *index_mp_to_orig = dm->getPolyDataArray(dm, CD_ORIGINDEX);
|
|
|
|
return index_mp_to_orig ? index_mp_to_orig[lt->poly] : lt->poly;
|
2013-08-06 02:16:29 +00:00
|
|
|
}
|
|
|
|
|
2015-12-02 19:07:24 +11:00
|
|
|
static void rna_Object_ray_cast(
|
|
|
|
Object *ob, ReportList *reports,
|
|
|
|
float origin[3], float direction[3], float distance,
|
|
|
|
int *r_success, float r_location[3], float r_normal[3], int *r_index)
|
2010-01-02 15:31:02 +00:00
|
|
|
{
|
2017-04-16 18:50:06 -03:00
|
|
|
bool success = false;
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
if (ob->derivedFinal == NULL) {
|
2012-10-20 10:28:34 +00:00
|
|
|
BKE_reportf(reports, RPT_ERROR, "Object '%s' has no mesh data to be used for ray casting", ob->id.name + 2);
|
2010-01-02 15:31:02 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2017-04-15 01:31:24 -03:00
|
|
|
/* Test BoundBox first (efficiency) */
|
2017-04-15 00:44:05 -03:00
|
|
|
BoundBox *bb = BKE_object_boundbox_get(ob);
|
2017-04-16 18:50:06 -03:00
|
|
|
float distmin;
|
2017-04-18 09:41:15 +02:00
|
|
|
if (!bb || (isect_ray_aabb_v3_simple(origin, direction, bb->vec[0], bb->vec[6], &distmin, NULL) && distmin <= distance)) {
|
2010-01-02 15:31:02 +00:00
|
|
|
|
2017-04-16 18:50:06 -03:00
|
|
|
BVHTreeFromMesh treeData = {NULL};
|
2010-01-02 15:31:02 +00:00
|
|
|
|
2017-04-16 18:50:06 -03:00
|
|
|
/* no need to managing allocation or freeing of the BVH data. this is generated and freed as needed */
|
|
|
|
bvhtree_from_mesh_looptri(&treeData, ob->derivedFinal, 0.0f, 4, 6);
|
2010-01-02 15:31:02 +00:00
|
|
|
|
2017-04-16 18:50:06 -03:00
|
|
|
/* may fail if the mesh has no faces, in that case the ray-cast misses */
|
|
|
|
if (treeData.tree != NULL) {
|
|
|
|
BVHTreeRayHit hit;
|
2010-01-02 15:31:02 +00:00
|
|
|
|
2017-04-16 18:50:06 -03:00
|
|
|
hit.index = -1;
|
|
|
|
hit.dist = distance;
|
2015-12-02 19:07:24 +11:00
|
|
|
|
2017-04-16 18:50:06 -03:00
|
|
|
normalize_v3(direction);
|
2015-12-02 19:07:24 +11:00
|
|
|
|
|
|
|
|
2017-04-16 18:50:06 -03:00
|
|
|
if (BLI_bvhtree_ray_cast(treeData.tree, origin, direction, 0.0f, &hit,
|
|
|
|
treeData.raycast_callback, &treeData) != -1)
|
|
|
|
{
|
|
|
|
if (hit.dist <= distance) {
|
|
|
|
*r_success = success = true;
|
2015-12-02 19:07:24 +11:00
|
|
|
|
2017-04-16 18:50:06 -03:00
|
|
|
copy_v3_v3(r_location, hit.co);
|
|
|
|
copy_v3_v3(r_normal, hit.no);
|
|
|
|
*r_index = dm_looptri_to_poly_index(ob->derivedFinal, &treeData.looptri[hit.index]);
|
|
|
|
}
|
2010-01-02 15:31:02 +00:00
|
|
|
}
|
|
|
|
|
2017-04-16 18:50:06 -03:00
|
|
|
free_bvhtree_from_mesh(&treeData);
|
2010-01-02 15:31:02 +00:00
|
|
|
}
|
|
|
|
}
|
2017-04-16 18:50:06 -03:00
|
|
|
if (success == false) {
|
|
|
|
*r_success = false;
|
2010-01-02 15:31:02 +00:00
|
|
|
|
2017-04-15 02:24:04 -03:00
|
|
|
zero_v3(r_location);
|
|
|
|
zero_v3(r_normal);
|
|
|
|
*r_index = -1;
|
|
|
|
}
|
2010-01-02 15:31:02 +00:00
|
|
|
}
|
|
|
|
|
2015-12-02 19:07:24 +11:00
|
|
|
static void rna_Object_closest_point_on_mesh(
|
|
|
|
Object *ob, ReportList *reports, float origin[3], float distance,
|
|
|
|
int *r_success, float r_location[3], float r_normal[3], int *r_index)
|
2011-07-17 12:40:18 +00:00
|
|
|
{
|
2012-03-05 23:30:41 +00:00
|
|
|
BVHTreeFromMesh treeData = {NULL};
|
2011-07-17 12:40:18 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
if (ob->derivedFinal == NULL) {
|
2012-10-20 10:28:34 +00:00
|
|
|
BKE_reportf(reports, RPT_ERROR, "Object '%s' has no mesh data to be used for finding nearest point",
|
2012-05-12 11:01:29 +00:00
|
|
|
ob->id.name + 2);
|
2011-07-17 12:40:18 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* no need to managing allocation or freeing of the BVH data. this is generated and freed as needed */
|
2015-07-23 15:38:50 +10:00
|
|
|
bvhtree_from_mesh_looptri(&treeData, ob->derivedFinal, 0.0f, 4, 6);
|
2011-07-17 12:40:18 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
if (treeData.tree == NULL) {
|
2012-10-20 10:28:34 +00:00
|
|
|
BKE_reportf(reports, RPT_ERROR, "Object '%s' could not create internal data for finding nearest point",
|
2012-05-12 11:01:29 +00:00
|
|
|
ob->id.name + 2);
|
2011-07-17 12:40:18 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
BVHTreeNearest nearest;
|
|
|
|
|
|
|
|
nearest.index = -1;
|
2015-12-02 19:07:24 +11:00
|
|
|
nearest.dist_sq = distance * distance;
|
2011-07-17 12:40:18 +00:00
|
|
|
|
2015-12-02 19:07:24 +11:00
|
|
|
if (BLI_bvhtree_find_nearest(treeData.tree, origin, &nearest, treeData.nearest_callback, &treeData) != -1) {
|
|
|
|
*r_success = true;
|
|
|
|
|
|
|
|
copy_v3_v3(r_location, nearest.co);
|
|
|
|
copy_v3_v3(r_normal, nearest.no);
|
|
|
|
*r_index = dm_looptri_to_poly_index(ob->derivedFinal, &treeData.looptri[nearest.index]);
|
|
|
|
|
|
|
|
goto finally;
|
2011-07-17 12:40:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-12-02 19:07:24 +11:00
|
|
|
*r_success = false;
|
|
|
|
|
|
|
|
zero_v3(r_location);
|
|
|
|
zero_v3(r_normal);
|
|
|
|
*r_index = -1;
|
|
|
|
|
|
|
|
finally:
|
2014-01-26 16:53:33 +01:00
|
|
|
free_bvhtree_from_mesh(&treeData);
|
2011-07-17 12:40:18 +00:00
|
|
|
}
|
|
|
|
|
2012-10-22 17:34:16 +00:00
|
|
|
static int rna_Object_is_modified(Object *ob, Scene *scene, int settings)
|
2011-03-16 08:53:35 +00:00
|
|
|
{
|
2012-05-05 14:03:12 +00:00
|
|
|
return BKE_object_is_modified(scene, ob) & settings;
|
2011-03-16 08:53:35 +00:00
|
|
|
}
|
|
|
|
|
2012-10-22 17:34:16 +00:00
|
|
|
static int rna_Object_is_deform_modified(Object *ob, Scene *scene, int settings)
|
2012-04-30 12:49:26 +00:00
|
|
|
{
|
2012-05-05 14:03:12 +00:00
|
|
|
return BKE_object_is_deform_modified(scene, ob) & settings;
|
2012-04-30 12:49:26 +00:00
|
|
|
}
|
|
|
|
|
2012-01-19 00:18:25 +00:00
|
|
|
#ifndef NDEBUG
|
|
|
|
void rna_Object_dm_info(struct Object *ob, int type, char *result)
|
|
|
|
{
|
|
|
|
DerivedMesh *dm = NULL;
|
2014-04-01 11:34:00 +11:00
|
|
|
bool dm_release = false;
|
2012-01-19 00:18:25 +00:00
|
|
|
char *ret = NULL;
|
|
|
|
|
|
|
|
result[0] = '\0';
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
switch (type) {
|
2012-01-19 00:18:25 +00:00
|
|
|
case 0:
|
|
|
|
if (ob->type == OB_MESH) {
|
2013-12-26 08:26:41 +11:00
|
|
|
dm = CDDM_from_mesh(ob->data);
|
2012-01-19 00:18:25 +00:00
|
|
|
ret = DM_debug_info(dm);
|
2014-04-01 11:34:00 +11:00
|
|
|
dm_release = true;
|
2012-01-19 00:18:25 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
dm = ob->derivedDeform;
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
dm = ob->derivedFinal;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (dm) {
|
|
|
|
ret = DM_debug_info(dm);
|
|
|
|
if (dm_release) {
|
|
|
|
dm->release(dm);
|
|
|
|
}
|
|
|
|
if (ret) {
|
|
|
|
strcpy(result, ret);
|
|
|
|
MEM_freeN(ret);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2013-03-21 16:06:46 +00:00
|
|
|
#endif /* NDEBUG */
|
2013-03-21 14:12:04 +00:00
|
|
|
|
|
|
|
static int rna_Object_update_from_editmode(Object *ob)
|
|
|
|
{
|
|
|
|
if (ob->mode & OB_MODE_EDIT) {
|
|
|
|
return ED_object_editmode_load(ob);
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
2012-12-28 13:21:57 +00:00
|
|
|
#else /* RNA_RUNTIME */
|
2009-06-18 19:48:55 +00:00
|
|
|
|
|
|
|
void RNA_api_object(StructRNA *srna)
|
|
|
|
{
|
|
|
|
FunctionRNA *func;
|
2009-06-19 10:40:18 +00:00
|
|
|
PropertyRNA *parm;
|
2009-06-18 19:48:55 +00:00
|
|
|
|
2017-10-18 15:07:26 +11:00
|
|
|
static const EnumPropertyItem mesh_type_items[] = {
|
2011-03-16 08:53:35 +00:00
|
|
|
{eModifierMode_Realtime, "PREVIEW", 0, "Preview", "Apply modifier preview settings"},
|
|
|
|
{eModifierMode_Render, "RENDER", 0, "Render", "Apply modifier render settings"},
|
2009-06-28 13:29:03 +00:00
|
|
|
{0, NULL, 0, NULL, NULL}
|
|
|
|
};
|
2009-06-24 19:23:34 +00:00
|
|
|
|
2017-10-18 15:07:26 +11:00
|
|
|
static const EnumPropertyItem dupli_eval_mode_items[] = {
|
2014-07-07 10:50:43 +02:00
|
|
|
{DAG_EVAL_VIEWPORT, "VIEWPORT", 0, "Viewport", "Generate duplis using viewport settings"},
|
|
|
|
{DAG_EVAL_PREVIEW, "PREVIEW", 0, "Preview", "Generate duplis using preview settings"},
|
|
|
|
{DAG_EVAL_RENDER, "RENDER", 0, "Render", "Generate duplis using render settings"},
|
|
|
|
{0, NULL, 0, NULL, NULL}
|
|
|
|
};
|
|
|
|
|
2012-01-19 00:18:25 +00:00
|
|
|
#ifndef NDEBUG
|
2017-10-18 15:07:26 +11:00
|
|
|
static const EnumPropertyItem mesh_dm_info_items[] = {
|
2012-01-19 00:18:25 +00:00
|
|
|
{0, "SOURCE", 0, "Source", "Source mesh"},
|
|
|
|
{1, "DEFORM", 0, "Deform", "Objects deform mesh"},
|
2012-03-11 15:27:08 +00:00
|
|
|
{2, "FINAL", 0, "Final", "Objects final mesh"},
|
2012-01-19 00:18:25 +00:00
|
|
|
{0, NULL, 0, NULL, NULL}
|
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
Render Layers and Collections (merge from render-layers)
Design Documents
----------------
* https://wiki.blender.org/index.php/Dev:2.8/Source/Layers
* https://wiki.blender.org/index.php/Dev:2.8/Source/DataDesignRevised
User Commit Log
---------------
* New Layer and Collection system to replace render layers and viewport layers.
* A layer is a set of collections of objects (and their drawing options) required for specific tasks.
* A collection is a set of objects, equivalent of the old layers in Blender. A collection can be shared across multiple layers.
* All Scenes have a master collection that all other collections are children of.
* New collection "context" tab (in Properties Editor)
* New temporary viewport "collections" panel to control per-collection
visibility
Missing User Features
---------------------
* Collection "Filter"
Option to add objects based on their names
* Collection Manager operators
The existing buttons are placeholders
* Collection Manager drawing
The editor main region is empty
* Collection Override
* Per-Collection engine settings
This will come as a separate commit, as part of the clay-engine branch
Dev Commit Log
--------------
* New DNA file (DNA_layer_types.h) with the new structs
We are replacing Base by a new extended Base while keeping it backward
compatible with some legacy settings (i.e., lay, flag_legacy).
Renamed all Base to BaseLegacy to make it clear the areas of code that
still need to be converted
Note: manual changes were required on - deg_builder_nodes.h, rna_object.c, KX_Light.cpp
* Unittesting for main syncronization requirements
- read, write, add/copy/remove objects, copy scene, collection
link/unlinking, context)
* New Editor: Collection Manager
Based on patch by Julian Eisel
This is extracted from the layer-manager branch. With the following changes:
- Renamed references of layer manager to collections manager
- I doesn't include the editors/space_collections/ draw and util files
- The drawing code itself will be implemented separately by Julian
* Base / Object:
A little note about them. Original Blender code would try to keep them
in sync through the code, juggling flags back and forth. This will now
be handled by Depsgraph, keeping Object and Bases more separated
throughout the non-rendering code.
Scene.base is being cleared in doversion, and the old viewport drawing
code was poorly converted to use the new bases while the new viewport
code doesn't get merged and replace the old one.
Python API Changes
------------------
```
- scene.layers
+ # no longer exists
- scene.objects
+ scene.scene_layers.active.objects
- scene.objects.active
+ scene.render_layers.active.objects.active
- bpy.context.scene.objects.link()
+ bpy.context.scene_collection.objects.link()
- bpy_extras.object_utils.object_data_add(context, obdata, operator=None, use_active_layer=True, name=None)
+ bpy_extras.object_utils.object_data_add(context, obdata, operator=None, name=None)
- bpy.context.object.select
+ bpy.context.object.select = True
+ bpy.context.object.select = False
+ bpy.context.object.select_get()
+ bpy.context.object.select_set(action='SELECT')
+ bpy.context.object.select_set(action='DESELECT')
-AddObjectHelper.layers
+ # no longer exists
```
2017-02-07 10:18:38 +01:00
|
|
|
static EnumPropertyItem object_select_items[] = {
|
|
|
|
{0, "SELECT", 0, "Select", "Select object from the active render layer"},
|
|
|
|
{1, "DESELECT", 0, "Deselect", "Deselect object from the active render layer"},
|
|
|
|
{2, "TOGGLE", 0, "Toggle", "Toggle object selection from the active render layer"},
|
|
|
|
{0, NULL, 0, NULL, NULL}
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Special wrapper to access the base selection value */
|
|
|
|
func = RNA_def_function(srna, "select_set", "rna_Object_select_set");
|
|
|
|
RNA_def_function_ui_description(func, "Select the object (for the active render layer)");
|
|
|
|
RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_REPORTS);
|
|
|
|
parm = RNA_def_enum(func, "action", object_select_items, 0, "Action", "Select mode");
|
|
|
|
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
|
|
|
|
|
|
|
|
func = RNA_def_function(srna, "select_get", "rna_Object_select_get");
|
|
|
|
RNA_def_function_ui_description(func, "Get the object selection for the active render layer");
|
|
|
|
RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_REPORTS);
|
|
|
|
parm = RNA_def_boolean(func, "result", 0, "", "Object selected");
|
|
|
|
RNA_def_function_return(func, parm);
|
|
|
|
|
2017-02-17 12:57:12 +01:00
|
|
|
func = RNA_def_function(srna, "visible_get", "rna_Object_visible_get");
|
|
|
|
RNA_def_function_ui_description(func, "Get the object visibility for the active render layer");
|
|
|
|
RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_REPORTS);
|
|
|
|
parm = RNA_def_boolean(func, "result", 0, "", "Object visible");
|
|
|
|
RNA_def_function_return(func, parm);
|
|
|
|
|
2012-12-28 13:21:57 +00:00
|
|
|
/* Matrix space conversion */
|
|
|
|
func = RNA_def_function(srna, "convert_space", "rna_Scene_mat_convert_space");
|
|
|
|
RNA_def_function_ui_description(func, "Convert (transform) the given matrix from one space to another");
|
|
|
|
RNA_def_function_flag(func, FUNC_USE_REPORTS);
|
|
|
|
parm = RNA_def_pointer(func, "pose_bone", "PoseBone", "",
|
|
|
|
"Bone to use to define spaces (may be None, in which case only the two 'WORLD' and "
|
|
|
|
"'LOCAL' spaces are usable)");
|
|
|
|
parm = RNA_def_property(func, "matrix", PROP_FLOAT, PROP_MATRIX);
|
|
|
|
RNA_def_property_multi_array(parm, 2, rna_matrix_dimsize_4x4);
|
|
|
|
RNA_def_property_ui_text(parm, "", "The matrix to transform");
|
|
|
|
parm = RNA_def_property(func, "matrix_return", PROP_FLOAT, PROP_MATRIX);
|
|
|
|
RNA_def_property_multi_array(parm, 2, rna_matrix_dimsize_4x4);
|
|
|
|
RNA_def_property_ui_text(parm, "", "The transformed matrix");
|
|
|
|
RNA_def_function_output(func, parm);
|
|
|
|
parm = RNA_def_enum(func, "from_space", space_items, CONSTRAINT_SPACE_WORLD, "",
|
|
|
|
"The space in which 'matrix' is currently");
|
|
|
|
parm = RNA_def_enum(func, "to_space", space_items, CONSTRAINT_SPACE_WORLD, "",
|
|
|
|
"The space to which you want to transform 'matrix'");
|
|
|
|
|
2015-01-03 12:05:16 +01:00
|
|
|
/* Camera-related operations */
|
|
|
|
func = RNA_def_function(srna, "calc_matrix_camera", "rna_Object_calc_matrix_camera");
|
|
|
|
RNA_def_function_ui_description(func, "Generate the camera projection matrix of this object "
|
|
|
|
"(mostly useful for Camera and Lamp types)");
|
|
|
|
parm = RNA_def_property(func, "result", PROP_FLOAT, PROP_MATRIX);
|
|
|
|
RNA_def_property_multi_array(parm, 2, rna_matrix_dimsize_4x4);
|
|
|
|
RNA_def_property_ui_text(parm, "", "The camera projection matrix");
|
|
|
|
RNA_def_function_output(func, parm);
|
|
|
|
parm = RNA_def_int(func, "x", 1, 0, INT_MAX, "", "Width of the render area", 0, 10000);
|
|
|
|
parm = RNA_def_int(func, "y", 1, 0, INT_MAX, "", "Height of the render area", 0, 10000);
|
|
|
|
parm = RNA_def_float(func, "scale_x", 1.0f, 1.0e-6f, FLT_MAX, "", "Width scaling factor", 1.0e-2f, 100.0f);
|
|
|
|
parm = RNA_def_float(func, "scale_y", 1.0f, 1.0e-6f, FLT_MAX, "", "height scaling factor", 1.0e-2f, 100.0f);
|
|
|
|
|
|
|
|
func = RNA_def_function(srna, "camera_fit_coords", "rna_Object_camera_fit_coords");
|
|
|
|
RNA_def_function_ui_description(func, "Compute the coordinate (and scale for ortho cameras) "
|
|
|
|
"given object should be to 'see' all given coordinates");
|
|
|
|
parm = RNA_def_pointer(func, "scene", "Scene", "", "Scene to get render size information from, if available");
|
Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
2016-12-12 15:23:55 +01:00
|
|
|
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
|
2015-01-03 12:05:16 +01:00
|
|
|
parm = RNA_def_float_array(func, "coordinates", 1, NULL, -FLT_MAX, FLT_MAX, "", "Coordinates to fit in",
|
|
|
|
-FLT_MAX, FLT_MAX);
|
Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
2016-12-12 15:23:55 +01:00
|
|
|
RNA_def_parameter_flags(parm, PROP_NEVER_NULL | PROP_DYNAMIC, PARM_REQUIRED);
|
2015-01-03 12:05:16 +01:00
|
|
|
parm = RNA_def_property(func, "co_return", PROP_FLOAT, PROP_XYZ);
|
|
|
|
RNA_def_property_array(parm, 3);
|
|
|
|
RNA_def_property_ui_text(parm, "", "The location to aim to be able to see all given points");
|
Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
2016-12-12 15:23:55 +01:00
|
|
|
RNA_def_parameter_flags(parm, 0, PARM_OUTPUT);
|
2015-01-03 12:05:16 +01:00
|
|
|
parm = RNA_def_property(func, "scale_return", PROP_FLOAT, PROP_NONE);
|
|
|
|
RNA_def_property_ui_text(parm, "", "The ortho scale to aim to be able to see all given points (if relevant)");
|
Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
2016-12-12 15:23:55 +01:00
|
|
|
RNA_def_parameter_flags(parm, 0, PARM_OUTPUT);
|
2015-01-03 12:05:16 +01:00
|
|
|
|
2009-07-13 11:04:18 +00:00
|
|
|
/* mesh */
|
2012-03-05 23:30:41 +00:00
|
|
|
func = RNA_def_function(srna, "to_mesh", "rna_Object_to_mesh");
|
2015-10-24 02:44:43 +11:00
|
|
|
RNA_def_function_ui_description(func, "Create a Mesh data-block with modifiers applied");
|
2017-07-21 11:53:13 +02:00
|
|
|
RNA_def_function_flag(func, FUNC_USE_REPORTS | FUNC_USE_CONTEXT);
|
2012-03-05 23:30:41 +00:00
|
|
|
parm = RNA_def_pointer(func, "scene", "Scene", "", "Scene within which to evaluate modifiers");
|
Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
2016-12-12 15:23:55 +01:00
|
|
|
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
|
2017-11-22 10:52:39 -02:00
|
|
|
parm = RNA_def_pointer(func, "view_layer", "ViewLayer", "", "Scene layer within which to evaluate modifiers");
|
2017-07-21 11:53:13 +02:00
|
|
|
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
|
2012-03-05 23:30:41 +00:00
|
|
|
parm = RNA_def_boolean(func, "apply_modifiers", 0, "", "Apply modifiers");
|
Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
2016-12-12 15:23:55 +01:00
|
|
|
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
|
2012-03-05 23:30:41 +00:00
|
|
|
parm = RNA_def_enum(func, "settings", mesh_type_items, 0, "", "Modifier settings to apply");
|
Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
2016-12-12 15:23:55 +01:00
|
|
|
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
|
2013-02-10 13:44:18 +00:00
|
|
|
RNA_def_boolean(func, "calc_tessface", true, "Calculate Tessellation", "Calculate tessellation faces");
|
2013-05-05 05:56:41 +00:00
|
|
|
RNA_def_boolean(func, "calc_undeformed", false, "Calculate Undeformed", "Calculate undeformed vertex coordinates");
|
2012-03-18 09:27:36 +00:00
|
|
|
parm = RNA_def_pointer(func, "mesh", "Mesh", "",
|
|
|
|
"Mesh created from object, remove it if it is only used for export");
|
2009-06-19 10:40:18 +00:00
|
|
|
RNA_def_function_return(func, parm);
|
2009-06-28 13:29:03 +00:00
|
|
|
|
2009-07-13 11:04:18 +00:00
|
|
|
/* duplis */
|
2012-03-05 23:30:41 +00:00
|
|
|
func = RNA_def_function(srna, "dupli_list_create", "rna_Object_create_duplilist");
|
2011-09-19 13:23:58 +00:00
|
|
|
RNA_def_function_ui_description(func, "Create a list of dupli objects for this object, needs to "
|
2012-05-12 11:01:29 +00:00
|
|
|
"be freed manually with free_dupli_list to restore the "
|
|
|
|
"objects real matrix and layers");
|
2012-03-05 23:30:41 +00:00
|
|
|
parm = RNA_def_pointer(func, "scene", "Scene", "", "Scene within which to evaluate duplis");
|
Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
2016-12-12 15:23:55 +01:00
|
|
|
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
|
2014-07-07 10:50:43 +02:00
|
|
|
RNA_def_enum(func, "settings", dupli_eval_mode_items, 0, "", "Generate texture coordinates for rendering");
|
2017-07-21 11:53:13 +02:00
|
|
|
RNA_def_function_flag(func, FUNC_USE_REPORTS | FUNC_USE_CONTEXT);
|
2009-06-19 10:40:18 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
func = RNA_def_function(srna, "dupli_list_clear", "rna_Object_free_duplilist");
|
2011-09-19 13:23:58 +00:00
|
|
|
RNA_def_function_ui_description(func, "Free the list of dupli objects");
|
2009-06-24 19:23:34 +00:00
|
|
|
|
2009-08-08 11:33:34 +00:00
|
|
|
/* Armature */
|
2012-03-05 23:30:41 +00:00
|
|
|
func = RNA_def_function(srna, "find_armature", "modifiers_isDeformedByArmature");
|
2011-09-19 13:23:58 +00:00
|
|
|
RNA_def_function_ui_description(func, "Find armature influencing this object as a parent or via a modifier");
|
2012-03-05 23:30:41 +00:00
|
|
|
parm = RNA_def_pointer(func, "ob_arm", "Object", "", "Armature object influencing this object or NULL");
|
2009-08-08 11:33:34 +00:00
|
|
|
RNA_def_function_return(func, parm);
|
|
|
|
|
2013-05-09 10:03:38 +00:00
|
|
|
/* Shape key */
|
2012-03-05 23:30:41 +00:00
|
|
|
func = RNA_def_function(srna, "shape_key_add", "rna_Object_shape_key_add");
|
2015-06-08 19:49:01 +10:00
|
|
|
RNA_def_function_ui_description(func, "Add shape key to this object");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_REPORTS);
|
2015-03-11 16:15:16 +05:00
|
|
|
RNA_def_string(func, "name", "Key", 0, "", "Unique name for the new keyblock"); /* optional */
|
2011-09-19 13:23:58 +00:00
|
|
|
RNA_def_boolean(func, "from_mix", 1, "", "Create new shape from existing mix of shapes");
|
2012-03-05 23:30:41 +00:00
|
|
|
parm = RNA_def_pointer(func, "key", "ShapeKey", "", "New shape keyblock");
|
Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
2016-12-12 15:23:55 +01:00
|
|
|
RNA_def_parameter_flags(parm, 0, PARM_RNAPTR);
|
2009-12-28 18:03:04 +00:00
|
|
|
RNA_def_function_return(func, parm);
|
|
|
|
|
2015-06-08 19:49:01 +10:00
|
|
|
func = RNA_def_function(srna, "shape_key_remove", "rna_Object_shape_key_remove");
|
|
|
|
RNA_def_function_ui_description(func, "Remove a Shape Key from this object");
|
|
|
|
RNA_def_function_flag(func, FUNC_USE_MAIN | FUNC_USE_REPORTS);
|
|
|
|
parm = RNA_def_pointer(func, "key", "ShapeKey", "", "Keyblock to be removed");
|
Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
2016-12-12 15:23:55 +01:00
|
|
|
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
|
|
|
|
RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
|
2015-06-08 19:49:01 +10:00
|
|
|
|
2010-01-02 15:31:02 +00:00
|
|
|
/* Ray Cast */
|
2012-03-05 23:30:41 +00:00
|
|
|
func = RNA_def_function(srna, "ray_cast", "rna_Object_ray_cast");
|
2011-09-19 13:23:58 +00:00
|
|
|
RNA_def_function_ui_description(func, "Cast a ray onto in object space");
|
2010-01-02 15:31:02 +00:00
|
|
|
RNA_def_function_flag(func, FUNC_USE_REPORTS);
|
|
|
|
|
|
|
|
/* ray start and end */
|
2015-12-02 19:07:24 +11:00
|
|
|
parm = RNA_def_float_vector(func, "origin", 3, NULL, -FLT_MAX, FLT_MAX, "", "", -1e4, 1e4);
|
Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
2016-12-12 15:23:55 +01:00
|
|
|
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
|
2015-12-02 19:07:24 +11:00
|
|
|
parm = RNA_def_float_vector(func, "direction", 3, NULL, -FLT_MAX, FLT_MAX, "", "", -1e4, 1e4);
|
Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
2016-12-12 15:23:55 +01:00
|
|
|
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
|
2016-01-12 09:37:56 +01:00
|
|
|
RNA_def_float(func, "distance", BVH_RAYCAST_DIST_MAX, 0.0, BVH_RAYCAST_DIST_MAX,
|
|
|
|
"", "Maximum distance", 0.0, BVH_RAYCAST_DIST_MAX);
|
2010-01-02 15:31:02 +00:00
|
|
|
|
|
|
|
/* return location and normal */
|
2015-12-02 19:07:24 +11:00
|
|
|
parm = RNA_def_boolean(func, "result", 0, "", "");
|
|
|
|
RNA_def_function_output(func, parm);
|
2012-03-18 09:27:36 +00:00
|
|
|
parm = RNA_def_float_vector(func, "location", 3, NULL, -FLT_MAX, FLT_MAX, "Location",
|
|
|
|
"The hit location of this ray cast", -1e4, 1e4);
|
Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
2016-12-12 15:23:55 +01:00
|
|
|
RNA_def_parameter_flags(parm, PROP_THICK_WRAP, 0);
|
2010-01-24 10:51:59 +00:00
|
|
|
RNA_def_function_output(func, parm);
|
2012-03-18 09:27:36 +00:00
|
|
|
parm = RNA_def_float_vector(func, "normal", 3, NULL, -FLT_MAX, FLT_MAX, "Normal",
|
|
|
|
"The face normal at the ray cast hit location", -1e4, 1e4);
|
Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
2016-12-12 15:23:55 +01:00
|
|
|
RNA_def_parameter_flags(parm, PROP_THICK_WRAP, 0);
|
2010-01-24 10:51:59 +00:00
|
|
|
RNA_def_function_output(func, parm);
|
2015-12-02 19:07:24 +11:00
|
|
|
parm = RNA_def_int(func, "index", 0, 0, 0, "", "The face index, -1 when original data isn't available", 0, 0);
|
2010-01-24 10:51:59 +00:00
|
|
|
RNA_def_function_output(func, parm);
|
2010-01-02 15:31:02 +00:00
|
|
|
|
2011-07-17 12:40:18 +00:00
|
|
|
/* Nearest Point */
|
2012-03-05 23:30:41 +00:00
|
|
|
func = RNA_def_function(srna, "closest_point_on_mesh", "rna_Object_closest_point_on_mesh");
|
2015-06-30 15:47:44 +10:00
|
|
|
RNA_def_function_ui_description(func, "Find the nearest point in object space");
|
2011-07-17 12:40:18 +00:00
|
|
|
RNA_def_function_flag(func, FUNC_USE_REPORTS);
|
|
|
|
|
2011-07-19 15:21:21 +00:00
|
|
|
/* location of point for test and max distance */
|
2015-12-02 19:07:24 +11:00
|
|
|
parm = RNA_def_float_vector(func, "origin", 3, NULL, -FLT_MAX, FLT_MAX, "", "", -1e4, 1e4);
|
Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
2016-12-12 15:23:55 +01:00
|
|
|
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
|
2011-08-04 13:22:38 +00:00
|
|
|
/* default is sqrt(FLT_MAX) */
|
2015-12-02 19:07:24 +11:00
|
|
|
RNA_def_float(func, "distance", 1.844674352395373e+19, 0.0, FLT_MAX, "", "Maximum distance", 0.0, FLT_MAX);
|
2011-07-17 12:40:18 +00:00
|
|
|
|
|
|
|
/* return location and normal */
|
2015-12-02 19:07:24 +11:00
|
|
|
parm = RNA_def_boolean(func, "result", 0, "", "");
|
|
|
|
RNA_def_function_output(func, parm);
|
2012-03-18 09:27:36 +00:00
|
|
|
parm = RNA_def_float_vector(func, "location", 3, NULL, -FLT_MAX, FLT_MAX, "Location",
|
|
|
|
"The location on the object closest to the point", -1e4, 1e4);
|
Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
2016-12-12 15:23:55 +01:00
|
|
|
RNA_def_parameter_flags(parm, PROP_THICK_WRAP, 0);
|
2011-07-17 12:40:18 +00:00
|
|
|
RNA_def_function_output(func, parm);
|
2012-03-18 09:27:36 +00:00
|
|
|
parm = RNA_def_float_vector(func, "normal", 3, NULL, -FLT_MAX, FLT_MAX, "Normal",
|
|
|
|
"The face normal at the closest point", -1e4, 1e4);
|
Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
2016-12-12 15:23:55 +01:00
|
|
|
RNA_def_parameter_flags(parm, PROP_THICK_WRAP, 0);
|
2011-07-17 12:40:18 +00:00
|
|
|
RNA_def_function_output(func, parm);
|
|
|
|
|
2015-12-02 19:07:24 +11:00
|
|
|
parm = RNA_def_int(func, "index", 0, 0, 0, "", "The face index, -1 when original data isn't available", 0, 0);
|
2011-07-17 12:40:18 +00:00
|
|
|
RNA_def_function_output(func, parm);
|
|
|
|
|
2009-08-12 16:37:05 +00:00
|
|
|
/* View */
|
2011-03-16 08:53:35 +00:00
|
|
|
|
|
|
|
/* utility function for checking if the object is modified */
|
2012-03-05 23:30:41 +00:00
|
|
|
func = RNA_def_function(srna, "is_modified", "rna_Object_is_modified");
|
2011-09-19 13:23:58 +00:00
|
|
|
RNA_def_function_ui_description(func, "Determine if this object is modified from the base mesh data");
|
2012-03-05 23:30:41 +00:00
|
|
|
parm = RNA_def_pointer(func, "scene", "Scene", "", "");
|
Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
2016-12-12 15:23:55 +01:00
|
|
|
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
|
2012-03-05 23:30:41 +00:00
|
|
|
parm = RNA_def_enum(func, "settings", mesh_type_items, 0, "", "Modifier settings to apply");
|
Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
2016-12-12 15:23:55 +01:00
|
|
|
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
|
2012-03-05 23:30:41 +00:00
|
|
|
parm = RNA_def_boolean(func, "result", 0, "", "Object visibility");
|
2009-08-12 16:37:05 +00:00
|
|
|
RNA_def_function_return(func, parm);
|
2012-01-19 00:18:25 +00:00
|
|
|
|
2012-04-30 12:49:26 +00:00
|
|
|
func = RNA_def_function(srna, "is_deform_modified", "rna_Object_is_deform_modified");
|
|
|
|
RNA_def_function_ui_description(func, "Determine if this object is modified by a deformation from the base mesh data");
|
|
|
|
parm = RNA_def_pointer(func, "scene", "Scene", "", "");
|
Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
2016-12-12 15:23:55 +01:00
|
|
|
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
|
2012-04-30 12:49:26 +00:00
|
|
|
parm = RNA_def_enum(func, "settings", mesh_type_items, 0, "", "Modifier settings to apply");
|
Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
2016-12-12 15:23:55 +01:00
|
|
|
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
|
2012-04-30 12:49:26 +00:00
|
|
|
parm = RNA_def_boolean(func, "result", 0, "", "Object visibility");
|
|
|
|
RNA_def_function_return(func, parm);
|
2012-01-19 00:18:25 +00:00
|
|
|
|
|
|
|
#ifndef NDEBUG
|
|
|
|
/* mesh */
|
2012-03-05 23:30:41 +00:00
|
|
|
func = RNA_def_function(srna, "dm_info", "rna_Object_dm_info");
|
2012-01-19 00:18:25 +00:00
|
|
|
RNA_def_function_ui_description(func, "Returns a string for derived mesh data");
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
parm = RNA_def_enum(func, "type", mesh_dm_info_items, 0, "", "Modifier settings to apply");
|
Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
2016-12-12 15:23:55 +01:00
|
|
|
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
|
2012-01-19 00:18:25 +00:00
|
|
|
/* weak!, no way to return dynamic string type */
|
2014-01-16 21:43:22 +11:00
|
|
|
parm = RNA_def_string(func, "result", NULL, 16384, "result", "");
|
Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
2016-12-12 15:23:55 +01:00
|
|
|
RNA_def_parameter_flags(parm, PROP_THICK_WRAP, 0); /* needed for string return value */
|
2012-01-19 00:18:25 +00:00
|
|
|
RNA_def_function_output(func, parm);
|
|
|
|
#endif /* NDEBUG */
|
2013-03-21 14:12:04 +00:00
|
|
|
|
|
|
|
func = RNA_def_function(srna, "update_from_editmode", "rna_Object_update_from_editmode");
|
2016-05-31 12:39:58 -03:00
|
|
|
RNA_def_function_ui_description(func, "Load the objects edit-mode data into the object data");
|
2013-03-21 14:12:04 +00:00
|
|
|
parm = RNA_def_boolean(func, "result", 0, "", "Success");
|
|
|
|
RNA_def_function_return(func, parm);
|
2015-02-17 17:27:15 +05:00
|
|
|
|
|
|
|
func = RNA_def_function(srna, "cache_release", "BKE_object_free_caches");
|
|
|
|
RNA_def_function_ui_description(func, "Release memory used by caches associated with this object. Intended to be used by render engines only");
|
2009-06-18 19:48:55 +00:00
|
|
|
}
|
|
|
|
|
2012-12-28 13:21:57 +00:00
|
|
|
#endif /* RNA_RUNTIME */
|