Merge branch 'master' into blender2.8

This commit is contained in:
Sergey Sharybin 2017-04-03 15:15:56 +02:00
commit 5884c9f1ba
Notes: blender-bot 2023-02-14 09:34:18 +01:00
Referenced by issue #51122, Blender 2.8 - linux - File browser glitches out
25 changed files with 143 additions and 78 deletions

4
.gitmodules vendored
View File

@ -3,18 +3,22 @@
url = ../blender-addons.git
branch = blender2.8
ignore = all
branch = master
[submodule "release/scripts/addons_contrib"]
path = release/scripts/addons_contrib
url = ../blender-addons-contrib.git
branch = master
ignore = all
branch = master
[submodule "release/datafiles/locale"]
path = release/datafiles/locale
url = ../blender-translations.git
branch = master
ignore = all
branch = master
[submodule "source/tools"]
path = source/tools
url = ../blender-dev-tools.git
branch = master
ignore = all
branch = master

View File

@ -67,6 +67,9 @@ def get_platform(filename):
def get_branch(filename):
if filename.startswith("blender-2.8"):
return "blender2.8"
tokens = filename.split("-")
branch = ""

View File

@ -111,7 +111,8 @@ if builder.find('cmake') != -1:
if builder.endswith('vc2015'):
platform += "-vc14"
builderified_name = 'blender-{}-{}-{}'.format(blender_full_version, git_hash, platform)
if branch != '':
# NOTE: Blender 2.8 is already respected by blender_full_version.
if branch != '' and branch != 'blender2.8':
builderified_name = branch + "-" + builderified_name
os.rename(result_file, "{}.zip".format(builderified_name))
@ -177,7 +178,8 @@ if builder.find('cmake') != -1:
blender_hash,
blender_glibc,
blender_arch)
if branch != '':
# NOTE: Blender 2.8 is already respected by blender_full_version.
if branch != '' and branch != 'blender2.8':
package_name = branch + "-" + package_name
upload_filename = package_name + ".tar.bz2"

View File

@ -1158,6 +1158,13 @@ static void add_nodes(Scene *scene,
/* Sync Materials */
void BlenderSync::sync_materials_simpligy(Shader *shader)
{
ShaderGraph *graph = shader->graph;
graph->simplify(scene);
shader->tag_update(scene);
}
void BlenderSync::sync_materials(bool update_all)
{
shader_map.set_default(scene->default_surface);
@ -1203,17 +1210,26 @@ void BlenderSync::sync_materials(bool update_all)
shader->set_graph(graph);
/* By simplifying the shader graph as soon as possible, some redundant shader nodes
* might be removed which prevents loading unneccessary attributes later.
/* By simplifying the shader graph as soon as possible, some
* redundant shader nodes might be removed which prevents loading
* unnecessary attributes later.
*
* However, since graph simplification also accounts for e.g. mix weight, this would
* cause frequent expensive resyncs in interactive sessions, so for those sessions
* optimization is only performed right before compiling. */
* However, since graph simplification also accounts for e.g. mix
* weight, this would cause frequent expensive resyncs in interactive
* sessions, so for those sessions optimization is only performed
* right before compiling.
*/
if(!preview) {
pool.push(function_bind(&ShaderGraph::simplify, shader->graph, scene));
pool.push(function_bind(&BlenderSync::sync_materials_simpligy,
this,
shader));
}
else {
/* NOTE: Update tagging can access links which are being
* optimized out.
*/
shader->tag_update(scene);
}
shader->tag_update(scene);
}
}

View File

@ -96,6 +96,7 @@ public:
private:
/* sync */
void sync_lamps(bool update_all);
void sync_materials_simpligy(Shader *shader);
void sync_materials(bool update_all);
void sync_objects(BL::SpaceView3D& b_v3d, float motion_time = 0.0f);
void sync_motion(BL::RenderSettings& b_render,

View File

@ -238,6 +238,8 @@ ShaderGraph *ShaderGraph::copy()
foreach(ShaderNode *node, nodes)
newgraph->add(nodes_copy[node]);
newgraph->simplified = simplified;
return newgraph;
}
@ -245,7 +247,6 @@ void ShaderGraph::connect(ShaderOutput *from, ShaderInput *to)
{
assert(!finalized);
assert(from && to);
simplified = false;
if(to->link) {
fprintf(stderr, "Cycles shader graph connect: input already connected.\n");

View File

@ -412,7 +412,7 @@ void AbcExporter::createTransformWriter(Object *ob, Object *parent, Object *dupl
BLI_assert(ob != dupliObParent);
/* check if we have already created a transform writer for this object */
if (getXForm(name) != NULL){
if (getXForm(name) != NULL) {
std::cerr << "xform " << name << " already exists\n";
return;
}

View File

@ -304,7 +304,9 @@ void ArmatureExporter::add_bone_transform(Object *ob_arm, Bone *bone, COLLADASW:
}
}
bc_sanitize_mat(mat, 6); // XXX: Make this optional ?
if (this->export_settings->limit_precision)
bc_sanitize_mat(mat, 6);
TransformWriter::add_node_transform(node, mat, NULL);
}

View File

@ -533,7 +533,8 @@ std::string ControllerExporter::add_inv_bind_mats_source(Object *ob_arm, ListBas
invert_m4_m4(mat, world);
converter.mat4_to_dae(inv_bind_mat, mat);
bc_sanitize_mat(inv_bind_mat, 6); // XXX: Make this optional ?
if (this->export_settings->limit_precision)
bc_sanitize_mat(inv_bind_mat, 6);
source.appendValues(inv_bind_mat);
}
}

View File

@ -53,6 +53,7 @@ public:
BC_export_transformation_type export_transformation_type;
bool open_sim;
bool limit_precision;
bool keep_bind_info;
char *filepath;

View File

@ -59,7 +59,7 @@ int collada_import(bContext *C,
import_settings.find_chains = find_chains != 0;
import_settings.fix_orientation = fix_orientation != 0;
import_settings.min_chain_length = min_chain_length;
import_settings.keep_bind_info = keep_bind_info;
import_settings.keep_bind_info = keep_bind_info !=0;
DocumentImporter imp(C, &import_settings);
if (imp.import()) return 1;
@ -90,7 +90,7 @@ int collada_export(Scene *sce,
int sort_by_name,
BC_export_transformation_type export_transformation_type,
int open_sim,
int limit_precision,
int keep_bind_info)
{
ExportSettings export_settings;
@ -116,8 +116,8 @@ int collada_export(Scene *sce,
export_settings.sort_by_name = sort_by_name != 0;
export_settings.export_transformation_type = export_transformation_type;
export_settings.open_sim = open_sim != 0;
export_settings.keep_bind_info = keep_bind_info;
export_settings.limit_precision = limit_precision != 0;
export_settings.keep_bind_info = keep_bind_info !=0;
int includeFilter = OB_REL_NONE;
if (export_settings.include_armatures) includeFilter |= OB_REL_MOD_ARMATURE;

View File

@ -85,6 +85,7 @@ int collada_export(struct Scene *sce,
BC_export_transformation_type export_transformation_type,
int open_sim,
int limit_precision,
int keep_bind_info);
#ifdef __cplusplus

View File

@ -32,9 +32,6 @@
#include "COLLADAFWMeshPrimitive.h"
#include "COLLADAFWMeshVertexData.h"
#include "collada_utils.h"
#include "ExportSettings.h"
extern "C" {
#include "DNA_modifier_types.h"
#include "DNA_customdata_types.h"
@ -64,6 +61,9 @@ extern "C" {
#include "bmesh_tools.h"
}
#include "collada_utils.h"
#include "ExportSettings.h"
float bc_get_float_value(const COLLADAFW::FloatOrDoubleArray& array, unsigned int index)
{
if (index >= array.getValuesCount())
@ -823,24 +823,12 @@ void bc_create_restpose_mat(const ExportSettings *export_settings, Bone *bone, f
}
/*
To get rid of those lengthy float values which make the numbers unreadable.
*/
float bc_sanitize_float(float value, float precision)
{
float result = floor((value * pow(10, precision) + 0.5)) / pow(10, precision);
if (abs(result) < 1 / pow(10, precision)) {
result = 0;
}
return result;
}
/*
Make 4*4 matrices better readable
*/
void bc_sanitize_mat(float mat[4][4], float precision)
void bc_sanitize_mat(float mat[4][4], int precision)
{
for (int i = 0; i < 4; i++)
for (int j = 0; j < 4; j++)
mat[i][j] = bc_sanitize_float(mat[i][j], precision);
mat[i][j] = double_round(mat[i][j], precision);
}

View File

@ -97,8 +97,7 @@ extern bool bc_is_leaf_bone(Bone *bone);
extern EditBone *bc_get_edit_bone(bArmature * armature, char *name);
extern int bc_set_layer(int bitfield, int layer, bool enable);
extern int bc_set_layer(int bitfield, int layer);
extern float bc_sanitize_float(float value, float precision);
extern void bc_sanitize_mat(float mat[4][4], float precision);
extern void bc_sanitize_mat(float mat[4][4], int precision);
extern IDProperty *bc_get_IDProperty(Bone *bone, std::string key);
extern void bc_set_IDProperty(EditBone *ebone, const char *key, float value);

View File

@ -351,15 +351,24 @@ void DEG_graph_on_visible_update(Main *bmain, Scene *scene)
/* Special trick to get local view to work. */
LINKLIST_FOREACH (Base *, base, &scene->base) {
Object *object = base->object;
DEG::IDDepsNode *node = graph->find_id_node(&object->id);
node->layers = 0;
DEG::IDDepsNode *id_node = graph->find_id_node(&object->id);
id_node->layers = 0;
}
LINKLIST_FOREACH (Base *, base, &scene->base) {
Object *object = base->object;
DEG::IDDepsNode *node = graph->find_id_node(&object->id);
node->layers |= base->lay;
DEG::IDDepsNode *id_node = graph->find_id_node(&object->id);
id_node->layers |= base->lay;
}
DEG::deg_graph_build_flush_layers(graph);
LINKLIST_FOREACH (Base *, base, &scene->base) {
Object *object = base->object;
DEG::IDDepsNode *id_node = graph->find_id_node(&object->id);
GHASH_FOREACH_BEGIN(DEG::ComponentDepsNode *, comp, id_node->components)
{
id_node->layers |= comp->layers;
}
GHASH_FOREACH_END();
}
}
void DEG_on_visible_update(Main *bmain, const bool UNUSED(do_time))

View File

@ -2126,10 +2126,10 @@ static int gp_count_subdivision_cuts(bGPDstroke *gps)
int totnewpoints = 0;
for (i = 0, pt = gps->points; i < gps->totpoints && pt; i++, pt++) {
if (pt->flag & GP_SPOINT_SELECT) {
if (i + 1 < gps->totpoints){
if (i + 1 < gps->totpoints) {
if (gps->points[i + 1].flag & GP_SPOINT_SELECT) {
++totnewpoints;
};
}
}
}
}
@ -2184,7 +2184,7 @@ static int gp_stroke_subdivide_exec(bContext *C, wmOperator *op)
/* if next point is selected add a half way point */
if (pt->flag & GP_SPOINT_SELECT) {
if (i + 1 < oldtotpoints){
if (i + 1 < oldtotpoints) {
if (temp_points[i + 1].flag & GP_SPOINT_SELECT) {
pt_final = &gps->points[i2];
/* Interpolate all values */
@ -2196,7 +2196,7 @@ static int gp_stroke_subdivide_exec(bContext *C, wmOperator *op)
pt_final->time = interpf(pt->time, next->time, 0.5f);
pt_final->flag |= GP_SPOINT_SELECT;
++i2;
};
}
}
}
}

View File

@ -2174,12 +2174,13 @@ static void ui_litem_layout_row(uiLayout *litem)
bool min_flag = item->flag & UI_ITEM_MIN;
/* ignore min flag for rows with right or center alignment */
if (item->type != ITEM_BUTTON &&
ELEM(((uiLayout *)item)->alignment, UI_LAYOUT_ALIGN_RIGHT, UI_LAYOUT_ALIGN_CENTER) &&
litem->alignment == UI_LAYOUT_ALIGN_EXPAND &&
((uiItem *)litem)->flag & UI_ITEM_MIN) {
ELEM(((uiLayout *)item)->alignment, UI_LAYOUT_ALIGN_RIGHT, UI_LAYOUT_ALIGN_CENTER) &&
litem->alignment == UI_LAYOUT_ALIGN_EXPAND &&
((uiItem *)litem)->flag & UI_ITEM_MIN)
{
min_flag = false;
}
if ((neww < minw || min_flag) && w != 0) {
/* fixed size */
item->flag |= UI_ITEM_FIXED;

View File

@ -99,6 +99,7 @@ static int wm_collada_export_exec(bContext *C, wmOperator *op)
int export_transformation_type;
int open_sim;
int limit_precision;
int keep_bind_info;
int export_count;
@ -150,6 +151,7 @@ static int wm_collada_export_exec(bContext *C, wmOperator *op)
export_transformation_type = RNA_enum_get(op->ptr, "export_transformation_type_selection");
open_sim = RNA_boolean_get(op->ptr, "open_sim");
limit_precision = RNA_boolean_get(op->ptr, "limit_precision");
keep_bind_info = RNA_boolean_get(op->ptr, "keep_bind_info");
/* get editmode results */
@ -178,6 +180,7 @@ static int wm_collada_export_exec(bContext *C, wmOperator *op)
export_transformation_type,
open_sim,
limit_precision,
keep_bind_info
);
@ -276,9 +279,13 @@ static void uiCollada_exportSettings(uiLayout *layout, PointerRNA *imfptr)
row = uiLayoutRow(box, false);
uiItemR(row, imfptr, "sort_by_name", 0, NULL, ICON_NONE);
row = uiLayoutRow(box, false);
uiItemR(row, imfptr, "keep_bind_info", 0, NULL, ICON_NONE);
row = uiLayoutRow(box, false);
uiItemR(row, imfptr, "limit_precision", 0, NULL, ICON_NONE);
}
static void wm_collada_export_draw(bContext *UNUSED(C), wmOperator *op)
@ -396,6 +403,9 @@ void WM_OT_collada_export(wmOperatorType *ot)
RNA_def_boolean(func, "open_sim", 0, "Export to SL/OpenSim",
"Compatibility mode for SL, OpenSim and other compatible online worlds");
RNA_def_boolean(func, "limit_precision", 0,
"Limit Precision", "Reduce the precision of the exported data to 6 digits");
RNA_def_boolean(func, "keep_bind_info", 0,
"Keep Bind Info", "Store Bindpose information in custom bone properties for later use during Collada export");
@ -437,7 +447,7 @@ static int wm_collada_import_exec(bContext *C, wmOperator *op)
auto_connect,
fix_orientation,
min_chain_length,
keep_bind_info) )
keep_bind_info) )
{
return OPERATOR_FINISHED;
}

View File

@ -1122,15 +1122,14 @@ static bool snapDerivedMesh(
float dist_px_sq = dist_squared_to_projected_aabb_simple(
lpmat, snapdata->win_half, ray_min_dist, snapdata->mval,
ray_org_local, ray_normal_local, bb->vec[0], bb->vec[6]);
if (dist_px_sq > SQUARE(*dist_px))
{
if (dist_px_sq > SQUARE(*dist_px)) {
return retval;
}
}
else {
/* was BKE_boundbox_ray_hit_check, see: cf6ca226fa58 */
if (!isect_ray_aabb_v3_simple(
ray_start_local, ray_normal_local, bb->vec[0], bb->vec[6], NULL, NULL))
ray_start_local, ray_normal_local, bb->vec[0], bb->vec[6], NULL, NULL))
{
return retval;
}

View File

@ -285,6 +285,7 @@ static void rna_Scene_collada_export(
int sort_by_name,
int export_transformation_type,
int open_sim,
int limit_precision,
int keep_bind_info)
{
collada_export(scene,
@ -311,6 +312,7 @@ static void rna_Scene_collada_export(
export_transformation_type,
open_sim,
limit_precision,
keep_bind_info);
}
@ -422,7 +424,12 @@ void RNA_api_scene(StructRNA *srna)
RNA_def_boolean(func, "open_sim", false,
"Export to SL/OpenSim", "Compatibility mode for SL, OpenSim and other compatible online worlds");
RNA_def_boolean(func, "keep_bind_info", false, "Keep Bind Info",
RNA_def_boolean(func, "limit_precision", false,
"Limit Precision",
"Reduce the precision of the exported data to 6 digits");
RNA_def_boolean(func, "keep_bind_info", false,
"Keep Bind Info",
"Store bind pose information in custom bone properties for later use during Collada export");
#endif

View File

@ -63,7 +63,7 @@ static void node_shader_exec_normal_map(void *data, int UNUSED(thread), bNode *n
CLAMP_MIN(strength, 0.0f);
float *N = shi->vno;
float *N = shi->nmapnorm;
int uv_index = 0;
switch (nm->space) {
case SHD_NORMAL_MAP_TANGENT:

View File

@ -1112,14 +1112,15 @@ static int multitex(Tex *tex,
const short which_output,
struct ImagePool *pool,
const bool skip_load_image,
const bool texnode_preview)
const bool texnode_preview,
const bool use_nodes)
{
float tmpvec[3];
int retval = 0; /* return value, int:0, col:1, nor:2, everything:3 */
texres->talpha = false; /* is set when image texture returns alpha (considered premul) */
if (tex->use_nodes && tex->nodetree) {
if (use_nodes && tex->use_nodes && tex->nodetree) {
retval = ntreeTexExecTree(tex->nodetree, texres, texvec, dxt, dyt, osatex, thread,
tex, which_output, R.r.cfra, texnode_preview, NULL, NULL);
}
@ -1239,7 +1240,8 @@ static int multitex_nodes_intern(Tex *tex,
ImagePool *pool,
const bool scene_color_manage,
const bool skip_load_image,
const bool texnode_preview)
const bool texnode_preview,
const bool use_nodes)
{
if (tex==NULL) {
memset(texres, 0, sizeof(TexResult));
@ -1264,7 +1266,8 @@ static int multitex_nodes_intern(Tex *tex,
which_output,
pool,
skip_load_image,
texnode_preview);
texnode_preview,
use_nodes);
if (mtex->mapto & (MAP_COL+MAP_COLSPEC+MAP_COLMIR)) {
ImBuf *ibuf = BKE_image_pool_acquire_ibuf(tex->ima, &tex->iuser, pool);
@ -1311,7 +1314,8 @@ static int multitex_nodes_intern(Tex *tex,
which_output,
pool,
skip_load_image,
texnode_preview);
texnode_preview,
use_nodes);
{
ImBuf *ibuf = BKE_image_pool_acquire_ibuf(tex->ima, &tex->iuser, pool);
@ -1341,7 +1345,8 @@ static int multitex_nodes_intern(Tex *tex,
which_output,
pool,
skip_load_image,
texnode_preview);
texnode_preview,
use_nodes);
}
}
@ -1354,7 +1359,8 @@ int multitex_nodes(Tex *tex, float texvec[3], float dxt[3], float dyt[3], int os
return multitex_nodes_intern(tex, texvec, dxt, dyt, osatex, texres,
thread, which_output, shi, mtex, pool, R.scene_color_manage,
(R.r.scemode & R_NO_IMAGE_LOAD) != 0,
(R.r.scemode & R_TEXNODE_PREVIEW) != 0);
(R.r.scemode & R_TEXNODE_PREVIEW) != 0,
true);
}
/* this is called for surface shading */
@ -1378,7 +1384,8 @@ static int multitex_mtex(ShadeInput *shi, MTex *mtex, float texvec[3], float dxt
mtex->which_output,
pool,
skip_load_image,
(R.r.scemode & R_TEXNODE_PREVIEW) != 0);
(R.r.scemode & R_TEXNODE_PREVIEW) != 0,
true);
}
}
@ -1408,7 +1415,8 @@ int multitex_ext(Tex *tex,
pool,
scene_color_manage,
skip_load_image,
false);
false,
true);
}
/* extern-tex doesn't support nodes (ntreeBeginExec() can't be called when rendering is going on)\
@ -1417,13 +1425,19 @@ int multitex_ext(Tex *tex,
*/
int multitex_ext_safe(Tex *tex, float texvec[3], TexResult *texres, struct ImagePool *pool, bool scene_color_manage, const bool skip_load_image)
{
int use_nodes= tex->use_nodes, retval;
tex->use_nodes = false;
retval= multitex_nodes_intern(tex, texvec, NULL, NULL, 0, texres, 0, 0, NULL, NULL, pool, scene_color_manage, skip_load_image, false);
tex->use_nodes= use_nodes;
return retval;
return multitex_nodes_intern(tex,
texvec,
NULL, NULL,
0,
texres,
0,
0,
NULL, NULL,
pool,
scene_color_manage,
skip_load_image,
false,
false);
}
@ -2873,7 +2887,8 @@ void do_volume_tex(ShadeInput *shi, const float *xyz, int mapto_flag, float col_
mtex->which_output,
re->pool,
skip_load_image,
texnode_preview); /* NULL = dxt/dyt, 0 = shi->osatex - not supported */
texnode_preview,
true); /* NULL = dxt/dyt, 0 = shi->osatex - not supported */
/* texture output */
@ -3051,7 +3066,8 @@ void do_halo_tex(HaloRen *har, float xn, float yn, float col_r[4])
mtex->which_output,
har->pool,
skip_load_image,
texnode_preview);
texnode_preview,
true);
/* texture output */
if (rgb && (mtex->texflag & MTEX_RGBTOINT)) {
@ -3274,7 +3290,8 @@ void do_sky_tex(
mtex->which_output,
R.pool,
skip_load_image,
texnode_preview);
texnode_preview,
true);
/* texture output */
if (rgb && (mtex->texflag & MTEX_RGBTOINT)) {
@ -3500,7 +3517,8 @@ void do_lamp_tex(LampRen *la, const float lavec[3], ShadeInput *shi, float col_r
mtex->which_output,
R.pool,
skip_load_image,
texnode_preview);
texnode_preview,
true);
/* texture output */
if (rgb && (mtex->texflag & MTEX_RGBTOINT)) {
@ -3614,7 +3632,8 @@ int externtex(MTex *mtex,
mtex->which_output,
pool,
skip_load_image,
texnode_preview);
texnode_preview,
true);
if (rgb) {
texr.tin = IMB_colormanagement_get_luminance(&texr.tr);

View File

@ -809,7 +809,7 @@ int wm_homefile_read(
if (userdef_template == NULL) {
/* we need to have preferences load to overwrite preferences from previous template */
userdef_template = BKE_blendfile_userdef_read_from_memory(
datatoc_startup_blend, datatoc_startup_blend_size, NULL);
datatoc_startup_blend, datatoc_startup_blend_size, NULL);
}
if (userdef_template) {
BKE_blender_userdef_set_app_template(userdef_template);

View File

@ -421,7 +421,7 @@ static void wm_window_set_dpi(wmWindow *win)
/* Blender's UI drawing assumes DPI 72 as a good default following macOS
* while Windows and Linux use DPI 96. GHOST assumes a default 96 so we
* remap the DPI to Blender's convention. */
int dpi = auto_dpi * U.ui_scale * (72.0/96.0f);
int dpi = auto_dpi * U.ui_scale * (72.0 / 96.0f);
/* Automatically set larger pixel size for high DPI. */
int pixelsize = MAX2(1, dpi / 54);

View File

@ -756,6 +756,7 @@ int collada_export(struct Scene *sce,
int sort_by_name,
BC_export_transformation_type export_transformation_type,
int open_sim,
int limit_precision,
int keep_bind_info) RET_ZERO
void ED_mesh_calc_tessface(struct Mesh *mesh, bool free_mpoly) RET_NONE