Compare commits

..

1 Commits

Author SHA1 Message Date
0b56bd0c55 TMP 2018-04-24 10:36:57 +02:00
581 changed files with 8842 additions and 14112 deletions

View File

@@ -2,6 +2,5 @@
"project_id" : "Blender",
"conduit_uri" : "https://developer.blender.org/",
"git.default-relative-commit" : "origin/blender2.8",
"arc.land.update.default" : "rebase",
"arc.land.onto.default" : "blender2.8"
"arc.land.update.default" : "rebase"
}

View File

@@ -236,10 +236,9 @@ help: .FORCE
@echo " * check_descriptions - check for duplicate/invalid descriptions"
@echo ""
@echo "Utilities (not associated with building blender)"
@echo " * icons - updates PNG icons from SVG files."
@echo " * icons_geom - updates Geometry icons from BLEND file."
@echo " * tgz - create a compressed archive of the source code."
@echo " * update - updates git and all submodules"
@echo " * icons - updates PNG icons from SVG files."
@echo " * tgz - create a compressed archive of the source code."
@echo " * update - updates git and all submodules"
@echo ""
@echo "Environment Variables"
@echo " * BUILD_CMAKE_ARGS - arguments passed to CMake."
@@ -424,12 +423,8 @@ icons: .FORCE
"$(BLENDER_DIR)/release/datafiles/blender_icons_update.py"
"$(BLENDER_DIR)/release/datafiles/prvicons_update.py"
icons_geom: .FORCE
BLENDER_BIN="$(BUILD_DIR)/bin/blender" \
"$(BLENDER_DIR)/release/datafiles/blender_icons_geom_update.py"
update: .FORCE
if [ "$(OS_NCASE)" = "darwin" ] && [ ! -d "../lib/$(OS_NCASE)" ]; then \
if [ "$(OS_NCASE)" == "darwin" ] && [ ! -d "../lib/$(OS_NCASE)" ]; then \
svn checkout https://svn.blender.org/svnroot/bf-blender/trunk/lib/$(OS_NCASE) ../lib/$(OS_NCASE) ; \
fi
if [ -d "../lib" ]; then \

View File

@@ -8,7 +8,7 @@ project(OpenVDB)
# --------------------------------------------------------------------------------
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules")
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules")
# --------------------------------------------------------------------------------

View File

@@ -88,14 +88,6 @@ elseif(WIN32)
set(DISABLE_RTTI "/EHs- /GR- ")
endif()
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
include(CheckCXXCompilerFlag)
check_cxx_compiler_flag("-flifetime-dse=1" SUPPORTS_FLIFETIME)
if (SUPPORTS_FLIFETIME)
add_definitions(-flifetime-dse=1)
endif()
endif()
# Linker export definitions
if (WIN32)
add_custom_command(OUTPUT tbb.def

View File

@@ -139,10 +139,6 @@ set(ZLIB_LIBRARY "/usr/lib${MULTILIB}/libz.a" CACHE STRING "" FORCE)
# OpenVDB
set(OPENVDB_LIBRARY
/opt/lib/openvdb/lib/libopenvdb.a
CACHE BOOL "" FORCE
)
set(BLOSC_LIBRARY
/opt/lib/blosc/lib/libblosc.a
CACHE BOOL "" FORCE
)

View File

@@ -1,72 +0,0 @@
# - Find Blosc library
# Find the native Blosc includes and library
# This module defines
# BLOSC_INCLUDE_DIRS, where to find blosc.h, Set when
# Blosc is found.
# BLOSC_LIBRARIES, libraries to link against to use Blosc.
# BLOSC_ROOT_DIR, The base directory to search for Blosc.
# This can also be an environment variable.
# BLOSC_FOUND, If false, do not try to use Blosc.
#
# also defined, but not for general use are
# BLOSC_LIBRARY, where to find the Blosc library.
#=============================================================================
# Copyright 2018 Blender Foundation.
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# If BLOSC_ROOT_DIR was defined in the environment, use it.
IF(NOT BLOSC_ROOT_DIR AND NOT $ENV{BLOSC_ROOT_DIR} STREQUAL "")
SET(BLOSC_ROOT_DIR $ENV{BLOSC_ROOT_DIR})
ENDIF()
SET(_blosc_SEARCH_DIRS
${BLOSC_ROOT_DIR}
/usr/local
/sw # Fink
/opt/local # DarwinPorts
/opt/lib/blosc
)
FIND_PATH(BLOSC_INCLUDE_DIR
NAMES
blosc.h
HINTS
${_blosc_SEARCH_DIRS}
PATH_SUFFIXES
include
)
FIND_LIBRARY(BLOSC_LIBRARY
NAMES
blosc
HINTS
${_blosc_SEARCH_DIRS}
PATH_SUFFIXES
lib64 lib
)
# handle the QUIETLY and REQUIRED arguments and set BLOSC_FOUND to TRUE if
# all listed variables are TRUE
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(BLOSC DEFAULT_MSG
BLOSC_LIBRARY BLOSC_INCLUDE_DIR)
IF(BLOSC_FOUND)
SET(BLOSC_LIBRARIES ${BLOSC_LIBRARY})
SET(BLOSC_INCLUDE_DIRS ${BLOSC_INCLUDE_DIR})
ELSE()
SET(BLOSC_BLOSC_FOUND FALSE)
ENDIF()
MARK_AS_ADVANCED(
BLOSC_INCLUDE_DIR
BLOSC_LIBRARY
)

View File

@@ -425,7 +425,7 @@ function(setup_liblinks
target_link_libraries(${target} ${OPENSUBDIV_LIBRARIES})
endif()
if(WITH_OPENVDB)
target_link_libraries(${target} ${OPENVDB_LIBRARIES} ${TBB_LIBRARIES} ${BLOSC_LIBRARIES})
target_link_libraries(${target} ${OPENVDB_LIBRARIES} ${TBB_LIBRARIES})
endif()
if(WITH_CYCLES_OSL)
target_link_libraries(${target} ${OSL_LIBRARIES})

View File

@@ -237,14 +237,10 @@ endif()
if(WITH_OPENVDB)
find_package_wrapper(OpenVDB)
find_package_wrapper(TBB)
find_package_wrapper(Blosc)
if(NOT OPENVDB_FOUND OR NOT TBB_FOUND)
set(WITH_OPENVDB OFF)
set(WITH_OPENVDB_BLOSC OFF)
message(STATUS "OpenVDB not found, disabling it")
elseif(NOT BLOSC_FOUND)
set(WITH_OPENVDB_BLOSC OFF)
message(STATUS "Blosc not found, disabling it")
endif()
endif()

View File

@@ -1195,7 +1195,7 @@ class CyclesCurveRenderSettings(bpy.types.PropertyGroup):
def update_render_passes(self, context):
scene = context.scene
rd = scene.render
view_layer = context.view_layer
view_layer = scene.view_layers.active
view_layer.update_render_passes()
class CyclesRenderLayerSettings(bpy.types.PropertyGroup):

View File

@@ -436,8 +436,8 @@ class CYCLES_RENDER_PT_performance(CyclesButtonsPanel, Panel):
split.prop(cscene, "preview_start_resolution")
class CYCLES_RENDER_PT_filter(CyclesButtonsPanel, Panel):
bl_label = "Filter"
class CYCLES_RENDER_PT_layer_options(CyclesButtonsPanel, Panel):
bl_label = "Layer"
bl_context = "view_layer"
def draw(self, context):
@@ -446,7 +446,7 @@ class CYCLES_RENDER_PT_filter(CyclesButtonsPanel, Panel):
scene = context.scene
rd = scene.render
view_layer = context.view_layer
view_layer = scene.view_layers.active
col = layout.column()
col.prop(view_layer, "use_sky", "Use Environment")
@@ -471,7 +471,7 @@ class CYCLES_RENDER_PT_layer_passes(CyclesButtonsPanel, Panel):
scene = context.scene
rd = scene.render
view_layer = context.view_layer
view_layer = scene.view_layers.active
cycles_view_layer = view_layer.cycles
split = layout.split()
@@ -538,6 +538,49 @@ class CYCLES_RENDER_PT_layer_passes(CyclesButtonsPanel, Panel):
col.prop(cycles_view_layer, "pass_debug_ray_bounces")
class CYCLES_RENDER_PT_views(CyclesButtonsPanel, Panel):
bl_label = "Views"
bl_context = "view_layer"
bl_options = {'DEFAULT_CLOSED'}
def draw_header(self, context):
rd = context.scene.render
self.layout.prop(rd, "use_multiview", text="")
def draw(self, context):
layout = self.layout
scene = context.scene
rd = scene.render
rv = rd.views.active
layout.active = rd.use_multiview
basic_stereo = (rd.views_format == 'STEREO_3D')
row = layout.row()
row.prop(rd, "views_format", expand=True)
if basic_stereo:
row = layout.row()
row.template_list("VIEWLAYER_UL_renderviews", "name", rd, "stereo_views", rd.views, "active_index", rows=2)
row = layout.row()
row.label(text="File Suffix:")
row.prop(rv, "file_suffix", text="")
else:
row = layout.row()
row.template_list("VIEWLAYER_UL_renderviews", "name", rd, "views", rd.views, "active_index", rows=2)
col = row.column(align=True)
col.operator("scene.render_view_add", icon='ZOOMIN', text="")
col.operator("scene.render_view_remove", icon='ZOOMOUT', text="")
row = layout.row()
row.label(text="Camera Suffix:")
row.prop(rv, "camera_suffix", text="")
class CYCLES_RENDER_PT_denoising(CyclesButtonsPanel, Panel):
bl_label = "Denoising"
bl_context = "view_layer"
@@ -545,7 +588,7 @@ class CYCLES_RENDER_PT_denoising(CyclesButtonsPanel, Panel):
def draw_header(self, context):
scene = context.scene
view_layer = context.view_layer
view_layer = scene.view_layers.active
cycles_view_layer = view_layer.cycles
cscene = scene.cycles
layout = self.layout
@@ -557,7 +600,7 @@ class CYCLES_RENDER_PT_denoising(CyclesButtonsPanel, Panel):
scene = context.scene
cscene = scene.cycles
view_layer = context.view_layer
view_layer = scene.view_layers.active
cycles_view_layer = view_layer.cycles
layout.active = cycles_view_layer.use_denoising
@@ -1545,8 +1588,9 @@ def get_panels():
'DATA_PT_spot',
'MATERIAL_PT_context_material',
'MATERIAL_PT_preview',
'VIEWLAYER_PT_filter',
'VIEWLAYER_PT_layer_options',
'VIEWLAYER_PT_layer_passes',
'VIEWLAYER_PT_views',
'RENDER_PT_post_processing',
'SCENE_PT_simplify',
}
@@ -1569,8 +1613,9 @@ classes = (
CYCLES_RENDER_PT_motion_blur,
CYCLES_RENDER_PT_film,
CYCLES_RENDER_PT_performance,
CYCLES_RENDER_PT_filter,
CYCLES_RENDER_PT_layer_options,
CYCLES_RENDER_PT_layer_passes,
CYCLES_RENDER_PT_views,
CYCLES_RENDER_PT_denoising,
CYCLES_PT_post_processing,
CYCLES_CAMERA_PT_dof,

View File

@@ -372,7 +372,7 @@ void BlenderSession::render(BL::Depsgraph& b_depsgraph_)
BufferParams buffer_params = BlenderSync::get_buffer_params(b_render, b_v3d, b_rv3d, scene->camera, width, height);
/* render each layer */
BL::ViewLayer b_view_layer = b_depsgraph.view_layer_eval();
BL::ViewLayer b_view_layer = b_depsgraph.view_layer();
/* We do some special meta attributes when we only have single layer. */
const bool is_single_layer = (b_scene.view_layers.length() == 1);

View File

@@ -1229,7 +1229,7 @@ void BlenderSync::sync_materials(BL::Depsgraph& b_depsgraph, bool update_all)
++b_mat_orig)
{
/* TODO(sergey): Iterate over evaluated data rather than using mapping. */
BL::Material b_mat_(b_depsgraph.id_eval_get(*b_mat_orig));
BL::Material b_mat_(b_depsgraph.evaluated_id_get(*b_mat_orig));
BL::Material *b_mat = &b_mat_;
Shader *shader;
@@ -1403,7 +1403,7 @@ void BlenderSync::sync_lamps(BL::Depsgraph& b_depsgraph, bool update_all)
++b_lamp_orig)
{
/* TODO(sergey): Iterate over evaluated data rather than using mapping. */
BL::Lamp b_lamp_(b_depsgraph.id_eval_get(*b_lamp_orig));
BL::Lamp b_lamp_(b_depsgraph.evaluated_id_get(*b_lamp_orig));
BL::Lamp *b_lamp = &b_lamp_;
Shader *shader;

View File

@@ -195,7 +195,7 @@ void BlenderSync::sync_data(BL::RenderSettings& b_render,
int width, int height,
void **python_thread_state)
{
BL::ViewLayer b_view_layer = b_depsgraph.view_layer_eval();
BL::ViewLayer b_view_layer = b_depsgraph.view_layer();
sync_view_layer(b_v3d, b_view_layer);
sync_integrator();

View File

@@ -248,7 +248,7 @@ void Device::draw_pixels(
if(rgba.data_type == TYPE_HALF) {
GLhalf *data_pointer = (GLhalf*)rgba.host_pointer;
data_pointer += 4 * y * w;
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA16F, w, h, 0, GL_RGBA, GL_HALF_FLOAT, data_pointer);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA16F_ARB, w, h, 0, GL_RGBA, GL_HALF_FLOAT, data_pointer);
}
else {
uint8_t *data_pointer = (uint8_t*)rgba.host_pointer;

View File

@@ -1684,7 +1684,7 @@ public:
min_blocks *= 8;
}
uint step_samples = divide_up(min_blocks * num_threads_per_block, wtile->w * wtile->h);
uint step_samples = divide_up(min_blocks * num_threads_per_block, wtile->w * wtile->h);;
/* Render all samples. */
int start_sample = rtile.start_sample;
@@ -1893,7 +1893,7 @@ public:
glGenTextures(1, &pmem.cuTexId);
glBindTexture(GL_TEXTURE_2D, pmem.cuTexId);
if(mem.data_type == TYPE_HALF)
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA16F, pmem.w, pmem.h, 0, GL_RGBA, GL_HALF_FLOAT, NULL);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA16F_ARB, pmem.w, pmem.h, 0, GL_RGBA, GL_HALF_FLOAT, NULL);
else
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, pmem.w, pmem.h, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);

View File

@@ -1452,7 +1452,7 @@ typedef struct KernelObject {
uint attribute_map_offset;
uint motion_offset;
uint pad;
} KernelObject;
} KernelObject;;
static_assert_align(KernelObject, 16);
typedef struct KernelSpotLight {

View File

@@ -216,7 +216,7 @@ ccl_device void svm_node_bevel(
if(stack_valid(normal_offset)) {
/* Preserve input normal. */
float3 ref_N = stack_load_float3(stack, normal_offset);
bevel_N = normalize(ref_N + (bevel_N - sd->N));
bevel_N = normalize(ref_N + (bevel_N - sd->N));;
}
stack_store_float3(stack, out_offset, bevel_N);

View File

@@ -141,7 +141,7 @@ ccl_device void svm_node_vector_displacement(KernelGlobals *kg, ShaderData *sd,
tangent = normalize(sd->dPdu);
}
float3 bitangent = normalize(cross(normal, tangent));
float3 bitangent = normalize(cross(normal, tangent));;
const AttributeDescriptor attr_sign = find_attribute(kg, sd, node.w);
if(attr_sign.offset != ATTR_STD_NOT_FOUND) {
float sign = primitive_attribute_float(kg, sd, attr_sign, NULL, NULL);

View File

@@ -4601,7 +4601,7 @@ void AttributeNode::compile(SVMCompiler& compiler)
ShaderOutput *vector_out = output("Vector");
ShaderOutput *fac_out = output("Fac");
ShaderNodeType attr_node = NODE_ATTR;
int attr = compiler.attribute_standard(attribute);
int attr = compiler.attribute_standard(attribute);;
if(bump == SHADER_BUMP_DX)
attr_node = NODE_ATTR_BUMP_DX;

View File

@@ -480,7 +480,7 @@ void ObjectManager::device_update_object_transform(UpdateObjectTransformState *s
kobject.dupli_uv[1] = ob->dupli_uv[1];
int totalsteps = mesh->motion_steps;
kobject.numsteps = (totalsteps - 1)/2;
kobject.numverts = mesh->verts.size();
kobject.numverts = mesh->verts.size();;
kobject.patch_map_offset = 0;
kobject.attribute_map_offset = 0;

View File

@@ -67,7 +67,7 @@ ccl_device_inline float len_squared(const float3 a);
ccl_device_inline float3 saturate3(float3 a);
ccl_device_inline float3 safe_normalize(const float3 a);
ccl_device_inline float3 normalize_len(const float3 a, float *t);
ccl_device_inline float3 normalize_len(const float3 a, float *t);;
ccl_device_inline float3 safe_normalize_len(const float3 a, float *t);
ccl_device_inline float3 interp(float3 a, float3 b, float t);

View File

@@ -115,7 +115,6 @@ void GWN_batch_uniform_3fv(Gwn_Batch*, const char* name, const float data[3]);
void GWN_batch_uniform_4fv(Gwn_Batch*, const char* name, const float data[4]);
void GWN_batch_uniform_2fv_array(Gwn_Batch*, const char* name, int len, const float *data);
void GWN_batch_uniform_4fv_array(Gwn_Batch*, const char* name, int len, const float *data);
void GWN_batch_uniform_mat4(Gwn_Batch*, const char* name, const float data[4][4]);
void GWN_batch_draw(Gwn_Batch*);

View File

@@ -22,7 +22,6 @@ typedef enum {
GWN_PRIM_TRI_STRIP,
GWN_PRIM_TRI_FAN,
GWN_PRIM_TRIS_ADJ,
GWN_PRIM_LINE_STRIP_ADJ,
GWN_PRIM_NONE

View File

@@ -503,12 +503,6 @@ void GWN_batch_uniform_4fv_array(Gwn_Batch* batch, const char* name, const int l
glUniform4fv(uniform->location, len, data);
}
void GWN_batch_uniform_mat4(Gwn_Batch* batch, const char* name, const float data[4][4])
{
GET_UNIFORM
glUniformMatrix4fv(uniform->location, 1, GL_FALSE, (const float *)data);
}
static void primitive_restart_enable(const Gwn_IndexBuf *el)
{
// TODO(fclem) Replace by GL_PRIMITIVE_RESTART_FIXED_INDEX when we have ogl 4.3

View File

@@ -25,7 +25,6 @@ Gwn_PrimClass GWN_primtype_class(Gwn_PrimType prim_type)
[GWN_PRIM_TRI_FAN] = GWN_PRIM_CLASS_SURFACE,
[GWN_PRIM_LINE_STRIP_ADJ] = GWN_PRIM_CLASS_LINE,
[GWN_PRIM_TRIS_ADJ] = GWN_PRIM_CLASS_SURFACE,
[GWN_PRIM_NONE] = GWN_PRIM_CLASS_NONE
};
@@ -53,12 +52,11 @@ GLenum convert_prim_type_to_gl(Gwn_PrimType prim_type)
[GWN_PRIM_LINES] = GL_LINES,
[GWN_PRIM_LINE_STRIP] = GL_LINE_STRIP,
[GWN_PRIM_LINE_LOOP] = GL_LINE_LOOP,
[GWN_PRIM_TRIS] = GL_TRIANGLES,
[GWN_PRIM_TRIS] = GWN_PRIM_CLASS_SURFACE,
[GWN_PRIM_TRI_STRIP] = GL_TRIANGLE_STRIP,
[GWN_PRIM_TRI_FAN] = GL_TRIANGLE_FAN,
[GWN_PRIM_LINE_STRIP_ADJ] = GL_LINE_STRIP_ADJACENCY,
[GWN_PRIM_TRIS_ADJ] = GL_TRIANGLES_ADJACENCY,
};
return table[prim_type];

View File

@@ -149,9 +149,7 @@ GHOST_TSuccess GHOST_ContextGLX::initializeDrawingContext()
(glXChooseFBConfig = (PFNGLXCHOOSEFBCONFIGPROC)glXGetProcAddressARB(
(const GLubyte *)"glXChooseFBConfig")) == NULL ||
(glXCreateContextAttribsARB = (PFNGLXCREATECONTEXTATTRIBSARBPROC)glXGetProcAddressARB(
(const GLubyte *)"glXCreateContextAttribsARB")) == NULL ||
(glXCreatePbuffer = (PFNGLXCREATEPBUFFERPROC)glXGetProcAddressARB(
(const GLubyte *)"glXCreatePbuffer")) == NULL)
(const GLubyte *)"glXCreateContextAttribsARB")) == NULL)
{
extStart = (GLubyte *)"";
}
@@ -327,8 +325,14 @@ const bool GLXEW_ARB_create_context_robustness =
version = glGetString(GL_VERSION);
#if 0 // enable this when Blender switches to 3.3 core profile
if (!version || version[0] < '3' || ((version[0] == '3') && (version[2] < '3'))) {
fprintf(stderr, "Error! Blender requires OpenGL 3.3 to run. Try updating your drivers.\n");
#else
// with Mesa, the closest thing to 3.3 compatibility profile is 3.0
if (!version || version[0] < '3') {
fprintf(stderr, "Error! Blender requires OpenGL 3.0 (soon 3.3) to run. Try updating your drivers.\n");
#endif
fflush(stderr);
/* ugly, but we get crashes unless a whole bunch of systems are patched. */
exit(0);

View File

@@ -323,33 +323,6 @@ static HWND clone_window(HWND hWnd, LPVOID lpParam)
return hwndCloned;
}
/* It can happen that glew has not been init yet but we need some wgl functions.
* This create a dummy context on the screen window and init glew to have correct
* functions pointers. */
static GHOST_TSuccess forceInitWGLEW(int iPixelFormat, PIXELFORMATDESCRIPTOR &chosenPFD)
{
HDC dummyHDC = GetDC(NULL);
if (!WIN32_CHK(::SetPixelFormat(dummyHDC, iPixelFormat, &chosenPFD)))
return GHOST_kFailure;
HGLRC dummyHGLRC = ::wglCreateContext(dummyHDC);
if (!WIN32_CHK(dummyHGLRC != NULL))
return GHOST_kFailure;
if (!WIN32_CHK(::wglMakeCurrent(dummyHDC, dummyHGLRC)))
return GHOST_kFailure;
if (GLEW_CHK(glewInit()) != GLEW_OK)
return GHOST_kFailure;
WIN32_CHK(::wglDeleteContext(dummyHGLRC));
WIN32_CHK(ReleaseDC(NULL, dummyHDC));
return GHOST_kSuccess;
}
void GHOST_ContextWGL::initContextWGLEW(PIXELFORMATDESCRIPTOR &preferredPFD)
{
@@ -391,14 +364,6 @@ void GHOST_ContextWGL::initContextWGLEW(PIXELFORMATDESCRIPTOR &preferredPFD)
}
else {
int iAttribList[] = {0};
if (wglCreatePbufferARB == NULL) {
/* This should only happen in background mode when rendering with opengl engine. */
if (forceInitWGLEW(iPixelFormat, chosenPFD) != GHOST_kSuccess) {
goto finalize;
}
}
dummyhBuffer = wglCreatePbufferARB(m_hDC, iPixelFormat, 1, 1, iAttribList);
dummyHDC = wglGetPbufferDCARB(dummyhBuffer);
}

View File

@@ -218,7 +218,7 @@ static bool ensureCurveMappingAllocated(OCIO_GLSLDrawState *state, OCIO_CurveMap
/* clean glError buffer */
while (glGetError() != GL_NO_ERROR) {}
glTexImage1D(GL_TEXTURE_1D, 0, GL_RGBA16F, curve_mapping_settings->lut_size,
glTexImage1D(GL_TEXTURE_1D, 0, GL_RGBA16F_ARB, curve_mapping_settings->lut_size,
0, GL_RGBA, GL_FLOAT, curve_mapping_settings->lut);
state->curve_mapping_texture_allocated = true;

View File

@@ -74,22 +74,7 @@ class TriMesh:
return me
def object_child_map(objects):
objects_children = {}
for ob in objects:
ob_parent = ob.parent
# Get the root.
if ob_parent is not None:
while ob_parent and ob_parent.parent:
ob_parent = ob_parent.parent
if ob_parent is not None:
objects_children.setdefault(ob_parent, []).append(ob)
for ob_all in objects_children.values():
ob_all.sort(key=lambda ob: ob.name)
return objects_children
def mesh_data_lists_from_mesh(me):
def write_mesh_data_lists(me):
me_loops = me.loops[:]
me_loops_color = me.vertex_colors.active.data[:]
me_verts = me.vertices[:]
@@ -102,11 +87,6 @@ def mesh_data_lists_from_mesh(me):
tris_colors = []
for p in me_polys:
# Backface culling (allows using spheres without tedious manual deleting).
if p.normal.z <= 0.0:
continue
l_sta = p.loop_start
l_len = p.loop_total
loops_poly = me_loops[l_sta:l_sta + l_len]
@@ -143,27 +123,7 @@ def mesh_data_lists_from_mesh(me):
return (tris_coords, tris_colors)
def mesh_data_lists_from_objects(ob_parent, ob_children):
tris_coords = []
tris_colors = []
has_parent = False
if ob_children:
parent_matrix = ob_parent.matrix_world.copy()
parent_matrix_inverted = parent_matrix.inverted()
for ob in (ob_parent, *ob_children):
with TriMesh(ob) as me:
if has_parent:
me.transform(parent_matrix_inverted * ob.matrix_world)
tris_coords_iter, tris_colors_iter = mesh_data_lists_from_mesh(me)
tris_coords.extend(tris_coords_iter)
tris_colors.extend(tris_colors_iter)
has_parent = True
return tris_coords, tris_colors
def write_mesh_to_py(fh, ob, ob_children):
def write_mesh_to_py(fh, ob):
def float_as_byte(f, axis_range):
assert(axis_range <= 255)
@@ -178,24 +138,13 @@ def write_mesh_to_py(fh, ob, ob_children):
float_as_byte(v[1], coords_range_align[1]),
)
tris_coords, tris_colors = mesh_data_lists_from_objects(ob, ob_children)
if 0:
# make as large as we can, keeping alignment
def size_scale_up(size):
assert(size != 0)
while size * 2 <= 255:
size *= 2
return size
coords_range = (
size_scale_up(ob.get("size_x")) or 255,
size_scale_up(ob.get("size_y")) or 255,
)
else:
# disable for now
coords_range = 255, 255
with TriMesh(ob) as me:
tris_coords, tris_colors = write_mesh_data_lists(me)
coords_range = (
ob.get("size_x") or 255,
ob.get("size_y") or 255,
)
# Pixel size needs to be increased since a pixel needs one extra geom coordinate,
# if we're writing 32 pixel, align verts to 33.
coords_range_align = tuple(min(c + 1, 255) for c in coords_range)
@@ -229,16 +178,6 @@ def create_argparse():
type=str,
metavar="DIR",
required=False,
help="Directory to write icons to.",
)
parser.add_argument(
"--group",
dest="group",
default="",
type=str,
metavar="GROUP",
required=False,
help="Group name to export from (otherwise export all objects).",
)
return parser
@@ -255,17 +194,7 @@ def main():
objects = []
if args.group:
group = bpy.data.groups.get(args.group)
if group is None:
print(f"Group {args.group!r} not found!")
return
objects_source = group.objects
del group
else:
objects_source = bpy.data.objects
for ob in objects_source:
for ob in bpy.data.objects:
# Skip non-mesh objects
if ob.type != 'MESH':
@@ -284,14 +213,10 @@ def main():
objects.sort(key=lambda a: a[0])
objects_children = object_child_map(bpy.data.objects)
for name, ob in objects:
if ob.parent:
continue
filename = os.path.join(args.output_dir, name + ".dat")
with open(filename, 'wb') as fh:
write_mesh_to_py(fh, ob, objects_children.get(ob, []))
write_mesh_to_py(fh, ob)
if __name__ == "__main__":

View File

@@ -1,83 +0,0 @@
#!/usr/bin/env python3
# This script updates icons from the BLEND file
import os
import subprocess
def run(cmd):
print(" ", " ".join(cmd))
# Don't use check_call because asan causes nonzero exitcode :S
subprocess.call(cmd)
def edit_text_file(filename, marker_begin, marker_end, content):
with open(filename, 'r', encoding='utf-8') as f:
data = f.read()
marker_begin_index = data.find(marker_begin)
marker_end_index = data.find(marker_end, marker_begin_index)
# include indentation of marker
while data[marker_end_index - 1] in {'\t', ' '}:
marker_end_index -= 1
if marker_begin_index == -1:
print('Error: {!r} not found'.format(marker_begin))
return
if marker_end_index == -1:
print('Error: {!r} not found'.format(marker_end))
return
marker_begin_index += len(marker_begin) + 1
data_update = data[:marker_begin_index] + content + data[marker_end_index:]
if data != data_update:
with open(filename, 'w', encoding='utf-8') as f:
f.write(data_update)
BASEDIR = os.path.abspath(os.path.dirname(__file__))
ROOTDIR = os.path.normpath(os.path.join(BASEDIR, "..", ".."))
blender_bin = os.environ.get("BLENDER_BIN", "blender")
if not os.path.exists(blender_bin):
blender_bin = os.path.join(ROOTDIR, "blender.bin")
icons_blend = (
os.path.join(ROOTDIR, "..", "lib", "resources", "icon_geom.blend"),
)
def names_and_time_from_path(path):
for entry in os.scandir(path):
name = entry.name
if name.endswith(".dat"):
yield (name, entry.stat().st_mtime)
# Collect icons files and update CMake.
icon_files = []
# create .dat geometry (which are stored in git)
for blend in icons_blend:
output_dir = os.path.join(BASEDIR, "icons")
files_old = set(names_and_time_from_path(output_dir))
cmd = (
blender_bin, "--background", "--factory-startup", "-noaudio",
blend,
"--python", os.path.join(BASEDIR, "blender_icons_geom.py"),
"--",
"--group", "Export",
"--output-dir", output_dir,
)
run(cmd)
files_new = set(names_and_time_from_path(output_dir))
icon_files.extend([
name[:-4] # no .dat
for (name, _) in sorted((files_new - files_old))
])
edit_text_file(
os.path.join(ROOTDIR, "source", "blender", "editors", "datafiles", "CMakeLists.txt"),
"# BEGIN ICON_GEOM_NAMES",
"# END ICON_GEOM_NAMES",
"\t" + "\n\t".join(icon_files) + "\n",
)

Binary file not shown.

View File

@@ -586,11 +586,11 @@ kmi.properties.nr = 9
kmi = km.keymap_items.new('view3d.layers', 'ZERO', 'PRESS', any=True)
kmi.properties.nr = 10
kmi = km.keymap_items.new('wm.context_toggle_enum', 'F3', 'PRESS')
kmi.properties.data_path = 'space_data.shading.type'
kmi.properties.data_path = 'space_data.viewport_shade'
kmi.properties.value_1 = 'SOLID'
kmi.properties.value_2 = 'WIREFRAME'
kmi = km.keymap_items.new('wm.context_toggle_enum', 'Z', 'PRESS', alt=True)
kmi.properties.data_path = 'space_data.shading.type'
kmi.properties.data_path = 'space_data.viewport_shade'
kmi.properties.value_1 = 'SOLID'
kmi.properties.value_2 = 'TEXTURED'
kmi = km.keymap_items.new('view3d.select_or_deselect_all', 'SELECTMOUSE', 'CLICK')

Some files were not shown because too many files have changed in this diff Show More