[Bf-blender-cvs] [6d4f75a123] render-layers: Merge remote-tracking branch 'origin/blender2.8' into render-layers
Clément Foucault
noreply at git.blender.org
Mon Feb 6 11:37:52 CET 2017
Commit: 6d4f75a123cdbc33d83b61e46b7bd2ede6cc0fe9
Author: Clément Foucault
Date: Mon Feb 6 11:35:49 2017 +0100
Branches: render-layers
https://developer.blender.org/rB6d4f75a123cdbc33d83b61e46b7bd2ede6cc0fe9
Merge remote-tracking branch 'origin/blender2.8' into render-layers
===================================================================
===================================================================
diff --cc release/scripts/startup/bl_operators/freestyle.py
index e899f7a1b0,fe3b00d54c..43cd3110be
--- a/release/scripts/startup/bl_operators/freestyle.py
+++ b/release/scripts/startup/bl_operators/freestyle.py
@@@ -73,17 -75,53 +75,53 @@@ class SCENE_OT_freestyle_fill_range_by_
else:
self.report({'ERROR'}, "Unexpected modifier type: " + m.type)
return {'CANCELLED'}
+ # Find selected vertices in editmesh
+ ob = bpy.context.active_object
+ if ob.type == 'MESH' and ob.mode == 'EDIT' and ob.name != ref.name:
+ bpy.ops.object.mode_set(mode='OBJECT')
+ selected_verts = [v for v in bpy.context.active_object.data.vertices if v.select]
+ bpy.ops.object.mode_set(mode='EDIT')
+ # Compute the min/max distance from the reference to mesh vertices
+ min_dist = sys.float_info.max
+ max_dist = -min_dist
+ if m.type == 'DISTANCE_FROM_CAMERA':
+ ob_to_cam = matrix_to_camera * ob.matrix_world
+ for vert in selected_verts:
+ # dist in the camera space
+ dist = (ob_to_cam * vert.co).length
+ min_dist = min(dist, min_dist)
+ max_dist = max(dist, max_dist)
+ elif m.type == 'DISTANCE_FROM_OBJECT':
+ for vert in selected_verts:
+ # dist in the world space
+ dist = (ob.matrix_world * vert.co - target_location).length
+ min_dist = min(dist, min_dist)
+ max_dist = max(dist, max_dist)
+ # Fill the Range Min/Max entries with the computed distances
+ m.range_min = min_dist
+ m.range_max = max_dist
+ return {'FINISHED'}
# Find selected mesh objects
- selection = [ob for ob in scene.objects if ob.select and ob.type == 'MESH' and ob.name != ref.name]
+ selection = [ob for ob in scene.objects if ob.select_get() and ob.type == 'MESH' and ob.name != source.name]
if selection:
- # Compute the min/max distance between selected mesh objects and the source
+ # Compute the min/max distance from the reference to mesh vertices
min_dist = sys.float_info.max
max_dist = -min_dist
- for ob in selection:
- for vert in ob.data.vertices:
- dist = (ob.matrix_world * vert.co - source.location).length
- min_dist = min(dist, min_dist)
- max_dist = max(dist, max_dist)
+ if m.type == 'DISTANCE_FROM_CAMERA':
+ for ob in selection:
+ ob_to_cam = matrix_to_camera * ob.matrix_world
+ for vert in ob.data.vertices:
+ # dist in the camera space
+ dist = (ob_to_cam * vert.co).length
+ min_dist = min(dist, min_dist)
+ max_dist = max(dist, max_dist)
+ elif m.type == 'DISTANCE_FROM_OBJECT':
+ for ob in selection:
+ for vert in ob.data.vertices:
+ # dist in the world space
+ dist = (ob.matrix_world * vert.co - target_location).length
+ min_dist = min(dist, min_dist)
+ max_dist = max(dist, max_dist)
# Fill the Range Min/Max entries with the computed distances
m.range_min = min_dist
m.range_max = max_dist
diff --cc source/blender/blenkernel/intern/library_query.c
index 99aab6daed,9685f1f5af..ef629ce7ef
--- a/source/blender/blenkernel/intern/library_query.c
+++ b/source/blender/blenkernel/intern/library_query.c
@@@ -334,15 -354,15 +355,15 @@@ void BKE_library_foreach_ID_link(Main *
Scene *scene = (Scene *) id;
ToolSettings *toolsett = scene->toolsettings;
SceneRenderLayer *srl;
- Base *base;
+ Base *legacy_base;
- CALLBACK_INVOKE(scene->camera, IDWALK_NOP);
- CALLBACK_INVOKE(scene->world, IDWALK_USER);
- CALLBACK_INVOKE(scene->set, IDWALK_NOP);
- CALLBACK_INVOKE(scene->clip, IDWALK_USER);
+ CALLBACK_INVOKE(scene->camera, IDWALK_CB_NOP);
+ CALLBACK_INVOKE(scene->world, IDWALK_CB_USER);
+ CALLBACK_INVOKE(scene->set, IDWALK_CB_NOP);
+ CALLBACK_INVOKE(scene->clip, IDWALK_CB_USER);
if (scene->nodetree) {
/* nodetree **are owned by IDs**, treat them as mere sub-data and not real ID! */
- library_foreach_ID_as_subdata_link((ID *)scene->nodetree, callback, user_data, flag, &data);
+ library_foreach_ID_as_subdata_link((ID **)&scene->nodetree, callback, user_data, flag, &data);
}
/* DO NOT handle scene->basact here, it's doubling with the loop over whole scene->base later,
* since basact is just a pointer to one of those items. */
@@@ -389,30 -409,10 +410,30 @@@
SEQ_END
}
- CALLBACK_INVOKE(scene->gpd, IDWALK_USER);
+ CALLBACK_INVOKE(scene->gpd, IDWALK_CB_USER);
- for (base = scene->base.first; base; base = base->next) {
- CALLBACK_INVOKE(base->object, IDWALK_CB_USER);
+ for (legacy_base = scene->base.first; legacy_base; legacy_base = legacy_base->next) {
- CALLBACK_INVOKE(legacy_base->object, IDWALK_USER);
++ CALLBACK_INVOKE(legacy_base->object, IDWALK_CB_USER);
+ }
+
+ SceneCollection *sc;
+ FOREACH_SCENE_COLLECTION(scene, sc)
+ {
+ for (LinkData *link = sc->objects.first; link; link = link->next) {
- CALLBACK_INVOKE_ID(link->data, IDWALK_USER);
++ CALLBACK_INVOKE_ID(link->data, IDWALK_CB_USER);
+ }
+
+ for (LinkData *link = sc->filter_objects.first; link; link = link->next) {
- CALLBACK_INVOKE_ID(link->data, IDWALK_USER);
++ CALLBACK_INVOKE_ID(link->data, IDWALK_CB_USER);
+ }
+ }
+ FOREACH_SCENE_COLLECTION_END
+
+ SceneLayer *sl;
+ for (sl = scene->render_layers.first; sl; sl = sl->next) {
+ for (ObjectBase *base = sl->object_bases.first; base; base = base->next) {
+ CALLBACK_INVOKE(base->object, IDWALK_NOP);
+ }
}
for (TimeMarker *marker = scene->markers.first; marker; marker = marker->next) {
diff --cc source/blender/draw/intern/draw_manager.c
index 729d9d19ce,0000000000..a7ce65060e
mode 100644,000000..100644
--- a/source/blender/draw/intern/draw_manager.c
+++ b/source/blender/draw/intern/draw_manager.c
@@@ -1,1142 -1,0 +1,1148 @@@
+/*
+ * Copyright 2016, Blender Foundation.
+ *
+ * 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
+ * of the License, or (at your option) any later version.
+ *
+ * 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,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributor(s): Blender Institute
+ *
+ */
+
+/** \file blender/draw/draw_manager.c
+ * \ingroup draw
+ */
+
+#include <stdio.h>
+
+#include "BLI_listbase.h"
+#include "BLI_rect.h"
+#include "BLI_string.h"
+
+#include "BIF_glutil.h"
+
+#include "BKE_global.h"
+
+#include "BLT_translation.h"
+
+#include "DRW_engine.h"
+#include "DRW_render.h"
+
+#include "DNA_view3d_types.h"
+
+#include "GPU_basic_shader.h"
+#include "GPU_batch.h"
+#include "GPU_draw.h"
+#include "GPU_extensions.h"
+#include "GPU_framebuffer.h"
+#include "GPU_immediate.h"
+#include "GPU_matrix.h"
+#include "GPU_shader.h"
+#include "GPU_texture.h"
+#include "GPU_uniformbuffer.h"
+#include "GPU_viewport.h"
+
+#include "RE_engine.h"
+
+#include "UI_resources.h"
+
+#include "clay.h"
+
+extern char datatoc_gpu_shader_2D_vert_glsl[];
+extern char datatoc_gpu_shader_3D_vert_glsl[];
+extern char datatoc_gpu_shader_basic_vert_glsl[];
+
+/* Structures */
+typedef enum {
+ DRW_UNIFORM_BOOL,
+ DRW_UNIFORM_INT,
+ DRW_UNIFORM_FLOAT,
+ DRW_UNIFORM_TEXTURE,
+ DRW_UNIFORM_BUFFER,
+ DRW_UNIFORM_MAT3,
+ DRW_UNIFORM_MAT4,
+ DRW_UNIFORM_BLOCK
+} DRWUniformType;
+
+struct DRWUniform {
+ struct DRWUniform *next, *prev;
+ DRWUniformType type;
+ int location;
+ int length;
+ int arraysize;
+ int bindloc;
+ const void *value;
+};
+
+struct DRWInterface {
+ ListBase uniforms;
+ /* matrices locations */
+ int modelview;
+ int projection;
+ int modelviewprojection;
+ int viewprojection;
+ int normal;
+ int eye;
+};
+
+struct DRWPass {
+ ListBase shgroups;
+ DRWState state;
+ float state_param; /* Line / Point width */
+};
+
+typedef struct DRWCall {
+ struct DRWCall *next, *prev;
+ Batch *geometry;
+ float(*obmat)[4];
+} DRWCall;
+
+struct DRWShadingGroup {
+ struct DRWShadingGroup *next, *prev;
+ struct GPUShader *shader; /* Shader to bind */
+ struct DRWInterface *interface; /* Uniforms pointers */
+ ListBase calls; /* List with all geometry and transforms */
+ int state; /* State changes for this batch only */
+ short dyntype; /* Dynamic Batch type, 0 is normal */
+ Batch *dyngeom; /* Dynamic batch */
+ GLuint instance_vbo; /* Dynamic batch VBO storing Model Matrices */
+ int instance_count; /* Dynamic batch Number of instance to render */
+};
+
+/* Render State */
+static struct DRWGlobalState{
+ GPUShader *shader;
+ struct GPUFrameBuffer *default_framebuffer;
+ FramebufferList *current_fbl;
+ TextureList *current_txl;
+ PassList *current_psl;
+ ListBase bound_texs;
+ int tex_bind_id;
+ float size[2];
+ float screenvecs[2][3];
+ float pixsize;
+ /* Current rendering context set by DRW_viewport_init */
+ const struct bContext *context;
+} DST = {NULL};
+
+/* **
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list