Cleanup: style
This commit is contained in:
parent
34a45c54e0
commit
9df1e54079
|
@ -170,7 +170,7 @@ def draw(layout, context, context_member, property_type, use_edit=True):
|
||||||
else:
|
else:
|
||||||
row = box.row(align=True)
|
row = box.row(align=True)
|
||||||
|
|
||||||
row.alignment = "RIGHT"
|
row.alignment = 'RIGHT'
|
||||||
|
|
||||||
row.label(text=key, translate=False)
|
row.label(text=key, translate=False)
|
||||||
|
|
||||||
|
|
|
@ -2440,9 +2440,9 @@ class WM_OT_studiolight_install(Operator):
|
||||||
)
|
)
|
||||||
orientation: EnumProperty(
|
orientation: EnumProperty(
|
||||||
items=(
|
items=(
|
||||||
("MATCAP", "MatCap", ""),
|
('MATCAP', "MatCap", ""),
|
||||||
("WORLD", "World", ""),
|
('WORLD', "World", ""),
|
||||||
("CAMERA", "Camera", ""),
|
('CAMERA', "Camera", ""),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -132,7 +132,7 @@ def point_cache_ui(self, context, cache, enabled, cachetype):
|
||||||
cache_info = cache.info
|
cache_info = cache.info
|
||||||
if cache_info:
|
if cache_info:
|
||||||
col = layout.column()
|
col = layout.column()
|
||||||
col.alignment = "RIGHT"
|
col.alignment = 'RIGHT'
|
||||||
col.label(text=cache_info)
|
col.label(text=cache_info)
|
||||||
else:
|
else:
|
||||||
if cachetype in {'SMOKE', 'DYNAMIC_PAINT'}:
|
if cachetype in {'SMOKE', 'DYNAMIC_PAINT'}:
|
||||||
|
@ -156,7 +156,7 @@ def point_cache_ui(self, context, cache, enabled, cachetype):
|
||||||
cache_info = cache.info
|
cache_info = cache.info
|
||||||
if cachetype != 'SMOKE' and cache_info: # avoid empty space.
|
if cachetype != 'SMOKE' and cache_info: # avoid empty space.
|
||||||
col = layout.column(align=True)
|
col = layout.column(align=True)
|
||||||
col.alignment = "RIGHT"
|
col.alignment = 'RIGHT'
|
||||||
col.label(text=cache_info)
|
col.label(text=cache_info)
|
||||||
|
|
||||||
can_bake = True
|
can_bake = True
|
||||||
|
@ -186,7 +186,7 @@ def point_cache_ui(self, context, cache, enabled, cachetype):
|
||||||
can_bake = False
|
can_bake = False
|
||||||
|
|
||||||
col = layout.column(align=True)
|
col = layout.column(align=True)
|
||||||
col.alignment = "RIGHT"
|
col.alignment = 'RIGHT'
|
||||||
|
|
||||||
col.separator()
|
col.separator()
|
||||||
|
|
||||||
|
|
|
@ -215,7 +215,7 @@ class SCENE_PT_keyframing_settings(SceneButtonsPanel, SceneKeyingSetsPanel, Pane
|
||||||
flow = layout.grid_flow(row_major=True, columns=0, even_columns=False, even_rows=False, align=True)
|
flow = layout.grid_flow(row_major=True, columns=0, even_columns=False, even_rows=False, align=True)
|
||||||
|
|
||||||
col = flow.column(align=True)
|
col = flow.column(align=True)
|
||||||
col.alignment = "RIGHT"
|
col.alignment = 'RIGHT'
|
||||||
col.label(text="General Override")
|
col.label(text="General Override")
|
||||||
|
|
||||||
self.draw_keyframing_settings(context, col, ks, None)
|
self.draw_keyframing_settings(context, col, ks, None)
|
||||||
|
@ -225,7 +225,7 @@ class SCENE_PT_keyframing_settings(SceneButtonsPanel, SceneKeyingSetsPanel, Pane
|
||||||
col.separator()
|
col.separator()
|
||||||
|
|
||||||
col = flow.column(align=True)
|
col = flow.column(align=True)
|
||||||
col.alignment = "RIGHT"
|
col.alignment = 'RIGHT'
|
||||||
col.label(text="Active Set Override")
|
col.label(text="Active Set Override")
|
||||||
|
|
||||||
self.draw_keyframing_settings(context, col, ks, ksp)
|
self.draw_keyframing_settings(context, col, ks, ksp)
|
||||||
|
@ -272,7 +272,7 @@ class SCENE_PT_keying_set_paths(SceneButtonsPanel, SceneKeyingSetsPanel, Panel):
|
||||||
ksp = ks.paths.active
|
ksp = ks.paths.active
|
||||||
if ksp:
|
if ksp:
|
||||||
col = flow.column(align=True)
|
col = flow.column(align=True)
|
||||||
col.alignment = "RIGHT"
|
col.alignment = 'RIGHT'
|
||||||
|
|
||||||
col.template_any_ID(ksp, "id", "id_type", text="Target ID-Block")
|
col.template_any_ID(ksp, "id", "id_type", text="Target ID-Block")
|
||||||
|
|
||||||
|
|
|
@ -23,8 +23,8 @@
|
||||||
* ***** END GPL LICENSE BLOCK *****
|
* ***** END GPL LICENSE BLOCK *****
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __BKE_SUBDIV_CONVERTER_H__
|
#ifndef __SUBDIV_CONVERTER_H__
|
||||||
#define __BKE_SUBDIV_CONVERTER_H__
|
#define __SUBDIV_CONVERTER_H__
|
||||||
|
|
||||||
#include "BKE_subdiv.h"
|
#include "BKE_subdiv.h"
|
||||||
|
|
||||||
|
@ -54,4 +54,4 @@ void BKE_subdiv_converter_free(struct OpenSubdiv_Converter *converter);
|
||||||
int BKE_subdiv_converter_fvar_linear_from_settings(
|
int BKE_subdiv_converter_fvar_linear_from_settings(
|
||||||
const SubdivSettings *settings);
|
const SubdivSettings *settings);
|
||||||
|
|
||||||
#endif /* __BKE_SUBDIV_CONVERTER_H__ */
|
#endif /* __SUBDIV_CONVERTER_H__ */
|
||||||
|
|
|
@ -152,7 +152,7 @@ static void edges_of_ptex_get(
|
||||||
typedef struct VerticesForInterpolation {
|
typedef struct VerticesForInterpolation {
|
||||||
/* This field points to a vertex data which is to be used for interpolation.
|
/* This field points to a vertex data which is to be used for interpolation.
|
||||||
* The idea is to avoid unnecessary allocations for regular faces, where
|
* The idea is to avoid unnecessary allocations for regular faces, where
|
||||||
* we can simply
|
* we can simply
|
||||||
*/
|
*/
|
||||||
const CustomData *vertex_data;
|
const CustomData *vertex_data;
|
||||||
/* Vertices data calculated for ptex corners. There are always 4 elements
|
/* Vertices data calculated for ptex corners. There are always 4 elements
|
||||||
|
@ -176,7 +176,7 @@ typedef struct VerticesForInterpolation {
|
||||||
static void vertex_interpolation_init(
|
static void vertex_interpolation_init(
|
||||||
const SubdivMeshContext *ctx,
|
const SubdivMeshContext *ctx,
|
||||||
VerticesForInterpolation *vertex_interpolation,
|
VerticesForInterpolation *vertex_interpolation,
|
||||||
const MPoly *coarse_poly)
|
const MPoly *coarse_poly)
|
||||||
{
|
{
|
||||||
const Mesh *coarse_mesh = ctx->coarse_mesh;
|
const Mesh *coarse_mesh = ctx->coarse_mesh;
|
||||||
const MLoop *coarse_mloop = coarse_mesh->mloop;
|
const MLoop *coarse_mloop = coarse_mesh->mloop;
|
||||||
|
@ -234,7 +234,8 @@ static void vertex_interpolation_from_ptex(
|
||||||
{
|
{
|
||||||
if (coarse_poly->totloop == 4) {
|
if (coarse_poly->totloop == 4) {
|
||||||
/* Nothing to do, all indices and data is already assigned. */
|
/* Nothing to do, all indices and data is already assigned. */
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
const CustomData *vertex_data = &ctx->coarse_mesh->vdata;
|
const CustomData *vertex_data = &ctx->coarse_mesh->vdata;
|
||||||
const Mesh *coarse_mesh = ctx->coarse_mesh;
|
const Mesh *coarse_mesh = ctx->coarse_mesh;
|
||||||
const MLoop *coarse_mloop = coarse_mesh->mloop;
|
const MLoop *coarse_mloop = coarse_mesh->mloop;
|
||||||
|
@ -287,7 +288,7 @@ static void vertex_interpolation_end(
|
||||||
typedef struct LoopsForInterpolation {
|
typedef struct LoopsForInterpolation {
|
||||||
/* This field points to a loop data which is to be used for interpolation.
|
/* This field points to a loop data which is to be used for interpolation.
|
||||||
* The idea is to avoid unnecessary allocations for regular faces, where
|
* The idea is to avoid unnecessary allocations for regular faces, where
|
||||||
* we can simply
|
* we can simply
|
||||||
*/
|
*/
|
||||||
const CustomData *loop_data;
|
const CustomData *loop_data;
|
||||||
/* Loops data calculated for ptex corners. There are always 4 elements
|
/* Loops data calculated for ptex corners. There are always 4 elements
|
||||||
|
@ -311,7 +312,7 @@ typedef struct LoopsForInterpolation {
|
||||||
static void loop_interpolation_init(
|
static void loop_interpolation_init(
|
||||||
const SubdivMeshContext *ctx,
|
const SubdivMeshContext *ctx,
|
||||||
LoopsForInterpolation *loop_interpolation,
|
LoopsForInterpolation *loop_interpolation,
|
||||||
const MPoly *coarse_poly)
|
const MPoly *coarse_poly)
|
||||||
{
|
{
|
||||||
const Mesh *coarse_mesh = ctx->coarse_mesh;
|
const Mesh *coarse_mesh = ctx->coarse_mesh;
|
||||||
if (coarse_poly->totloop == 4) {
|
if (coarse_poly->totloop == 4) {
|
||||||
|
@ -363,7 +364,8 @@ static void loop_interpolation_from_ptex(
|
||||||
{
|
{
|
||||||
if (coarse_poly->totloop == 4) {
|
if (coarse_poly->totloop == 4) {
|
||||||
/* Nothing to do, all indices and data is already assigned. */
|
/* Nothing to do, all indices and data is already assigned. */
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
const CustomData *loop_data = &ctx->coarse_mesh->ldata;
|
const CustomData *loop_data = &ctx->coarse_mesh->ldata;
|
||||||
const Mesh *coarse_mesh = ctx->coarse_mesh;
|
const Mesh *coarse_mesh = ctx->coarse_mesh;
|
||||||
const MLoop *coarse_mloop = coarse_mesh->mloop;
|
const MLoop *coarse_mloop = coarse_mesh->mloop;
|
||||||
|
@ -481,9 +483,10 @@ static void subdiv_evaluate_vertices(SubdivMeshContext *ctx,
|
||||||
vertex_interpolation_end(&vertex_interpolation);
|
vertex_interpolation_end(&vertex_interpolation);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void subdiv_copy_edge_data(SubdivMeshContext *ctx,
|
static void subdiv_copy_edge_data(
|
||||||
MEdge *subdiv_edge,
|
SubdivMeshContext *ctx,
|
||||||
const MEdge *coarse_edge)
|
MEdge *subdiv_edge,
|
||||||
|
const MEdge *coarse_edge)
|
||||||
{
|
{
|
||||||
if (coarse_edge == NULL) {
|
if (coarse_edge == NULL) {
|
||||||
subdiv_edge->crease = 0;
|
subdiv_edge->crease = 0;
|
||||||
|
@ -586,11 +589,12 @@ static void subdiv_create_edges(SubdivMeshContext *ctx, int poly_index)
|
||||||
EdgesOfPtex edges_of_ptex;
|
EdgesOfPtex edges_of_ptex;
|
||||||
edges_of_ptex_get(ctx, &edges_of_ptex, coarse_poly, i);
|
edges_of_ptex_get(ctx, &edges_of_ptex, coarse_poly, i);
|
||||||
/* Create bottom row of edges (0-1, 1-2). */
|
/* Create bottom row of edges (0-1, 1-2). */
|
||||||
subdiv_edge = subdiv_create_edges_row(ctx,
|
subdiv_edge = subdiv_create_edges_row(
|
||||||
subdiv_edge,
|
ctx,
|
||||||
edges_of_ptex.first_edge,
|
subdiv_edge,
|
||||||
start_ptex_face_vertex_index,
|
edges_of_ptex.first_edge,
|
||||||
resolution);
|
start_ptex_face_vertex_index,
|
||||||
|
resolution);
|
||||||
/* Create remaining edges. */
|
/* Create remaining edges. */
|
||||||
for (int row = 0; row < resolution - 1; row++) {
|
for (int row = 0; row < resolution - 1; row++) {
|
||||||
const int start_row_vertex_index =
|
const int start_row_vertex_index =
|
||||||
|
|
|
@ -92,7 +92,7 @@ BLI_INLINE uint64_t fmix64(uint64_t k)
|
||||||
|
|
||||||
uint32_t BLI_hash_mm3(const unsigned char *in, size_t len, uint32_t seed)
|
uint32_t BLI_hash_mm3(const unsigned char *in, size_t len, uint32_t seed)
|
||||||
{
|
{
|
||||||
const uint8_t *data = (const uint8_t*)in;
|
const uint8_t *data = (const uint8_t *)in;
|
||||||
const int nblocks = len / 4;
|
const int nblocks = len / 4;
|
||||||
|
|
||||||
uint32_t h1 = seed;
|
uint32_t h1 = seed;
|
||||||
|
@ -102,23 +102,23 @@ uint32_t BLI_hash_mm3(const unsigned char *in, size_t len, uint32_t seed)
|
||||||
|
|
||||||
/* body */
|
/* body */
|
||||||
|
|
||||||
const uint32_t *blocks = (const uint32_t *)(data + nblocks*4);
|
const uint32_t *blocks = (const uint32_t *)(data + nblocks * 4);
|
||||||
|
|
||||||
for (int i = -nblocks; i; i++) {
|
for (int i = -nblocks; i; i++) {
|
||||||
uint32_t k1 = getblock32(blocks,i);
|
uint32_t k1 = getblock32(blocks, i);
|
||||||
|
|
||||||
k1 *= c1;
|
k1 *= c1;
|
||||||
k1 = ROTL32(k1,15);
|
k1 = ROTL32(k1, 15);
|
||||||
k1 *= c2;
|
k1 *= c2;
|
||||||
|
|
||||||
h1 ^= k1;
|
h1 ^= k1;
|
||||||
h1 = ROTL32(h1,13);
|
h1 = ROTL32(h1, 13);
|
||||||
h1 = h1*5+0xe6546b64;
|
h1 = h1 * 5 + 0xe6546b64;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* tail */
|
/* tail */
|
||||||
|
|
||||||
const uint8_t *tail = (const uint8_t*)(data + nblocks*4);
|
const uint8_t *tail = (const uint8_t *)(data + nblocks * 4);
|
||||||
|
|
||||||
uint32_t k1 = 0;
|
uint32_t k1 = 0;
|
||||||
|
|
||||||
|
@ -132,10 +132,10 @@ uint32_t BLI_hash_mm3(const unsigned char *in, size_t len, uint32_t seed)
|
||||||
case 1:
|
case 1:
|
||||||
k1 ^= tail[0];
|
k1 ^= tail[0];
|
||||||
k1 *= c1;
|
k1 *= c1;
|
||||||
k1 = ROTL32(k1,15);
|
k1 = ROTL32(k1, 15);
|
||||||
k1 *= c2;
|
k1 *= c2;
|
||||||
h1 ^= k1;
|
h1 ^= k1;
|
||||||
};
|
}
|
||||||
|
|
||||||
/* finalization */
|
/* finalization */
|
||||||
|
|
||||||
|
|
|
@ -62,7 +62,7 @@ void CryptomatteNode::convertToOperations(NodeConverter &converter, const Compos
|
||||||
bNode *node = this->getbNode();
|
bNode *node = this->getbNode();
|
||||||
NodeCryptomatte *cryptoMatteSettings = (NodeCryptomatte *)node->storage;
|
NodeCryptomatte *cryptoMatteSettings = (NodeCryptomatte *)node->storage;
|
||||||
|
|
||||||
CryptomatteOperation *operation = new CryptomatteOperation(getNumberOfInputSockets()-1);
|
CryptomatteOperation *operation = new CryptomatteOperation(getNumberOfInputSockets() - 1);
|
||||||
if (cryptoMatteSettings) {
|
if (cryptoMatteSettings) {
|
||||||
if (cryptoMatteSettings->matte_id) {
|
if (cryptoMatteSettings->matte_id) {
|
||||||
/* Split the string by commas, ignoring white space. */
|
/* Split the string by commas, ignoring white space. */
|
||||||
|
@ -83,7 +83,7 @@ void CryptomatteNode::convertToOperations(NodeConverter &converter, const Compos
|
||||||
operation->addObjectIndex(atof(token.substr(1, token.length() - 2).c_str()));
|
operation->addObjectIndex(atof(token.substr(1, token.length() - 2).c_str()));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
uint32_t hash = BLI_hash_mm3((const unsigned char*)token.c_str(), token.length(), 0);
|
uint32_t hash = BLI_hash_mm3((const unsigned char *)token.c_str(), token.length(), 0);
|
||||||
operation->addObjectIndex(hash_to_float(hash));
|
operation->addObjectIndex(hash_to_float(hash));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -93,14 +93,14 @@ void CryptomatteNode::convertToOperations(NodeConverter &converter, const Compos
|
||||||
|
|
||||||
converter.addOperation(operation);
|
converter.addOperation(operation);
|
||||||
|
|
||||||
for (int i = 0; i < getNumberOfInputSockets()-1; ++i) {
|
for (int i = 0; i < getNumberOfInputSockets() - 1; ++i) {
|
||||||
converter.mapInputSocket(this->getInputSocket(i + 1), operation->getInputSocket(i));
|
converter.mapInputSocket(this->getInputSocket(i + 1), operation->getInputSocket(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
SeparateChannelOperation *separateOperation = new SeparateChannelOperation;
|
SeparateChannelOperation *separateOperation = new SeparateChannelOperation;
|
||||||
separateOperation->setChannel(3);
|
separateOperation->setChannel(3);
|
||||||
converter.addOperation(separateOperation);
|
converter.addOperation(separateOperation);
|
||||||
|
|
||||||
SetAlphaOperation *operationAlpha = new SetAlphaOperation();
|
SetAlphaOperation *operationAlpha = new SetAlphaOperation();
|
||||||
converter.addOperation(operationAlpha);
|
converter.addOperation(operationAlpha);
|
||||||
|
|
||||||
|
@ -117,5 +117,5 @@ void CryptomatteNode::convertToOperations(NodeConverter &converter, const Compos
|
||||||
converter.mapOutputSocket(outputSocketMatte, separateOperation->getOutputSocket(0));
|
converter.mapOutputSocket(outputSocketMatte, separateOperation->getOutputSocket(0));
|
||||||
converter.mapOutputSocket(outputSocketImage, operationAlpha->getOutputSocket(0));
|
converter.mapOutputSocket(outputSocketImage, operationAlpha->getOutputSocket(0));
|
||||||
converter.mapOutputSocket(outputSocketPick, clearAlphaOperation->getOutputSocket(0));
|
converter.mapOutputSocket(outputSocketPick, clearAlphaOperation->getOutputSocket(0));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,7 +63,7 @@ void CryptomatteOperation::executePixel(float output[4],
|
||||||
output[1] = ((float) ((m3hash << 8)) / (float) UINT32_MAX);
|
output[1] = ((float) ((m3hash << 8)) / (float) UINT32_MAX);
|
||||||
output[2] = ((float) ((m3hash << 16)) / (float) UINT32_MAX);
|
output[2] = ((float) ((m3hash << 16)) / (float) UINT32_MAX);
|
||||||
}
|
}
|
||||||
for(size_t i = 0; i < m_objectIndex.size(); i++) {
|
for (size_t i = 0; i < m_objectIndex.size(); i++) {
|
||||||
if (m_objectIndex[i] == input[0]) {
|
if (m_objectIndex[i] == input[0]) {
|
||||||
output[3] += input[1];
|
output[3] += input[1];
|
||||||
}
|
}
|
||||||
|
|
|
@ -269,9 +269,9 @@ void DEG_debug_print_eval_parent_typed(struct Depsgraph *depsgraph,
|
||||||
const void *parent_address);
|
const void *parent_address);
|
||||||
|
|
||||||
void DEG_debug_print_eval_time(struct Depsgraph *depsgraph,
|
void DEG_debug_print_eval_time(struct Depsgraph *depsgraph,
|
||||||
const char* function_name,
|
const char *function_name,
|
||||||
const char* object_name,
|
const char *object_name,
|
||||||
const void* object_address,
|
const void *object_address,
|
||||||
float time);
|
float time);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
|
@ -37,24 +37,29 @@
|
||||||
|
|
||||||
namespace DEG {
|
namespace DEG {
|
||||||
|
|
||||||
BuilderMap::BuilderMap() {
|
BuilderMap::BuilderMap()
|
||||||
|
{
|
||||||
set = BLI_gset_ptr_new("deg builder gset");
|
set = BLI_gset_ptr_new("deg builder gset");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BuilderMap::~BuilderMap() {
|
BuilderMap::~BuilderMap()
|
||||||
|
{
|
||||||
BLI_gset_free(set, NULL);
|
BLI_gset_free(set, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BuilderMap::checkIsBuilt(ID *id) {
|
bool BuilderMap::checkIsBuilt(ID *id)
|
||||||
|
{
|
||||||
return BLI_gset_haskey(set, id);
|
return BLI_gset_haskey(set, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BuilderMap::tagBuild(ID *id) {
|
void BuilderMap::tagBuild(ID *id)
|
||||||
|
{
|
||||||
BLI_gset_insert(set, id);
|
BLI_gset_insert(set, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BuilderMap::checkIsBuiltAndTag(ID *id) {
|
bool BuilderMap::checkIsBuiltAndTag(ID *id)
|
||||||
|
{
|
||||||
void **key_p;
|
void **key_p;
|
||||||
if (!BLI_gset_ensure_p_ex(set, id, &key_p)) {
|
if (!BLI_gset_ensure_p_ex(set, id, &key_p)) {
|
||||||
*key_p = id;
|
*key_p = id;
|
||||||
|
|
|
@ -158,7 +158,7 @@ struct DepsgraphNodeBuilder {
|
||||||
const char *name = "",
|
const char *name = "",
|
||||||
int name_tag = -1);
|
int name_tag = -1);
|
||||||
|
|
||||||
void build_id(ID* id);
|
void build_id(ID *id);
|
||||||
void build_layer_collections(ListBase *lb);
|
void build_layer_collections(ListBase *lb);
|
||||||
void build_view_layer(Scene *scene,
|
void build_view_layer(Scene *scene,
|
||||||
ViewLayer *view_layer,
|
ViewLayer *view_layer,
|
||||||
|
|
|
@ -33,11 +33,11 @@ void workbench_private_data_init(WORKBENCH_PrivateData *wpd)
|
||||||
|
|
||||||
if (wpd->shading.light == V3D_LIGHTING_MATCAP) {
|
if (wpd->shading.light == V3D_LIGHTING_MATCAP) {
|
||||||
wpd->studio_light = BKE_studiolight_find(
|
wpd->studio_light = BKE_studiolight_find(
|
||||||
wpd->shading.matcap, STUDIOLIGHT_ORIENTATION_VIEWNORMAL);
|
wpd->shading.matcap, STUDIOLIGHT_ORIENTATION_VIEWNORMAL);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
wpd->studio_light = BKE_studiolight_find(
|
wpd->studio_light = BKE_studiolight_find(
|
||||||
wpd->shading.studio_light, STUDIOLIGHT_ORIENTATION_CAMERA | STUDIOLIGHT_ORIENTATION_WORLD);
|
wpd->shading.studio_light, STUDIOLIGHT_ORIENTATION_CAMERA | STUDIOLIGHT_ORIENTATION_WORLD);
|
||||||
}
|
}
|
||||||
wpd->shadow_multiplier = 1.0 - wpd->shading.shadow_intensity;
|
wpd->shadow_multiplier = 1.0 - wpd->shading.shadow_intensity;
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** \file workbench_volumed.c
|
/** \file workbench_volume.c
|
||||||
* \ingroup draw_engine
|
* \ingroup draw_engine
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
@ -901,7 +901,7 @@ GPUBatch *DRW_cache_empty_capsule_cap_get(void)
|
||||||
float v[3] = {0.0f, 0.0f, 0.0f};
|
float v[3] = {0.0f, 0.0f, 0.0f};
|
||||||
copy_v2_v2(v, p[(i) % NSEGMENTS]);
|
copy_v2_v2(v, p[(i) % NSEGMENTS]);
|
||||||
GPU_vertbuf_attr_set(vbo, attr_id.pos, vidx++, v);
|
GPU_vertbuf_attr_set(vbo, attr_id.pos, vidx++, v);
|
||||||
copy_v2_v2(v, p[(i+1) % NSEGMENTS]);
|
copy_v2_v2(v, p[(i + 1) % NSEGMENTS]);
|
||||||
GPU_vertbuf_attr_set(vbo, attr_id.pos, vidx++, v);
|
GPU_vertbuf_attr_set(vbo, attr_id.pos, vidx++, v);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -828,7 +828,7 @@ static void shader_preview_free(void *customdata)
|
||||||
ShaderPreview *sp = customdata;
|
ShaderPreview *sp = customdata;
|
||||||
Main *pr_main = sp->pr_main;
|
Main *pr_main = sp->pr_main;
|
||||||
|
|
||||||
if (sp->id_copy){
|
if (sp->id_copy) {
|
||||||
switch (GS(sp->id_copy->name)) {
|
switch (GS(sp->id_copy->name)) {
|
||||||
case ID_MA:
|
case ID_MA:
|
||||||
BKE_material_free((Material *)sp->id_copy);
|
BKE_material_free((Material *)sp->id_copy);
|
||||||
|
|
|
@ -33,14 +33,14 @@
|
||||||
#define PROGRAM_NO_OPTI 0
|
#define PROGRAM_NO_OPTI 0
|
||||||
|
|
||||||
#if defined(NDEBUG)
|
#if defined(NDEBUG)
|
||||||
#define TRUST_NO_ONE 0
|
# define TRUST_NO_ONE 0
|
||||||
#else
|
#else
|
||||||
/* strict error checking, enabled for debug builds during early development */
|
/* strict error checking, enabled for debug builds during early development */
|
||||||
#define TRUST_NO_ONE 1
|
# define TRUST_NO_ONE 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(WITH_OPENGL)
|
#if defined(WITH_OPENGL)
|
||||||
#include <GL/glew.h>
|
# include <GL/glew.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
@ -48,7 +48,7 @@
|
||||||
#include "BLI_sys_types.h"
|
#include "BLI_sys_types.h"
|
||||||
|
|
||||||
#if TRUST_NO_ONE
|
#if TRUST_NO_ONE
|
||||||
#include <assert.h>
|
# include <assert.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* GPU_INLINE */
|
/* GPU_INLINE */
|
||||||
|
|
|
@ -35,7 +35,7 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#if GPU_VERT_ATTR_MAX_LEN != 16
|
#if GPU_VERT_ATTR_MAX_LEN != 16
|
||||||
#error "attrib binding code assumes GPU_VERT_ATTR_MAX_LEN = 16"
|
# error "attrib binding code assumes GPU_VERT_ATTR_MAX_LEN = 16"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void AttribBinding_clear(GPUAttrBinding *binding)
|
void AttribBinding_clear(GPUAttrBinding *binding)
|
||||||
|
|
|
@ -35,9 +35,11 @@
|
||||||
#include "GPU_vertex_format.h"
|
#include "GPU_vertex_format.h"
|
||||||
#include "GPU_shader_interface.h"
|
#include "GPU_shader_interface.h"
|
||||||
|
|
||||||
void AttribBinding_clear(GPUAttrBinding*);
|
void AttribBinding_clear(GPUAttrBinding *binding);
|
||||||
|
|
||||||
void get_attrib_locations(const GPUVertFormat*, GPUAttrBinding*, const GPUShaderInterface*);
|
void get_attrib_locations(
|
||||||
unsigned read_attrib_location(const GPUAttrBinding*, unsigned a_idx);
|
const GPUVertFormat *format, GPUAttrBinding *binding, const GPUShaderInterface *shaderface);
|
||||||
|
unsigned read_attrib_location(
|
||||||
|
const GPUAttrBinding *binding, unsigned a_idx);
|
||||||
|
|
||||||
#endif /* __GPU_ATTR_BINDING_PRIVATE_H__ */
|
#endif /* __GPU_ATTR_BINDING_PRIVATE_H__ */
|
||||||
|
|
|
@ -41,10 +41,10 @@ extern "C" {
|
||||||
#include "GPU_context.h"
|
#include "GPU_context.h"
|
||||||
#include "GPU_shader_interface.h"
|
#include "GPU_shader_interface.h"
|
||||||
|
|
||||||
void gpu_batch_remove_interface_ref(GPUBatch*, const GPUShaderInterface*);
|
void gpu_batch_remove_interface_ref(GPUBatch *batch, const GPUShaderInterface *interface);
|
||||||
|
|
||||||
void gpu_context_add_batch(GPUContext*, GPUBatch*);
|
void gpu_context_add_batch(GPUContext *ctx, GPUBatch *batch);
|
||||||
void gpu_context_remove_batch(GPUContext*, GPUBatch*);
|
void gpu_context_remove_batch(GPUContext *ctx, GPUBatch *batch);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
#define ORPHAN_DEBUG 0
|
#define ORPHAN_DEBUG 0
|
||||||
|
|
||||||
#if ORPHAN_DEBUG
|
#if ORPHAN_DEBUG
|
||||||
#include <cstdio>
|
# include <cstdio>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static std::vector<GLuint> orphaned_buffer_ids;
|
static std::vector<GLuint> orphaned_buffer_ids;
|
||||||
|
|
|
@ -701,17 +701,17 @@ void immVertex2iv(uint attrib_id, const int data[2])
|
||||||
/* --- generic uniform functions --- */
|
/* --- generic uniform functions --- */
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
#if TRUST_NO_ONE
|
# if TRUST_NO_ONE
|
||||||
#define GET_UNIFORM const GPUShaderInput* uniform = GPU_shaderinterface_uniform(imm.shader_interface, name); assert(uniform);
|
# define GET_UNIFORM const GPUShaderInput* uniform = GPU_shaderinterface_uniform(imm.shader_interface, name); assert(uniform);
|
||||||
#else
|
# else
|
||||||
#define GET_UNIFORM const GPUShaderInput* uniform = GPU_shaderinterface_uniform(imm.shader_interface, name);
|
# define GET_UNIFORM const GPUShaderInput* uniform = GPU_shaderinterface_uniform(imm.shader_interface, name);
|
||||||
#endif
|
# endif
|
||||||
#else
|
#else
|
||||||
/* NOTE: It is possible to have uniform fully optimized out from the shader.
|
/* NOTE: It is possible to have uniform fully optimized out from the shader.
|
||||||
* In this case we can't assert failure or allow NULL-pointer dereference.
|
* In this case we can't assert failure or allow NULL-pointer dereference.
|
||||||
* TODO(sergey): How can we detect existing-but-optimized-out uniform but still
|
* TODO(sergey): How can we detect existing-but-optimized-out uniform but still
|
||||||
* catch typos in uniform names passed to immUniform*() functions? */
|
* catch typos in uniform names passed to immUniform*() functions? */
|
||||||
#define GET_UNIFORM const GPUShaderInput* uniform = GPU_shaderinterface_uniform(imm.shader_interface, name); if (uniform == NULL) return;
|
# define GET_UNIFORM const GPUShaderInput* uniform = GPU_shaderinterface_uniform(imm.shader_interface, name); if (uniform == NULL) return;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void immUniform1f(const char *name, float x)
|
void immUniform1f(const char *name, float x)
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
* ***** END GPL LICENSE BLOCK *****
|
* ***** END GPL LICENSE BLOCK *****
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** \file blender/gpu/intern/gpu_imm_util.c
|
/** \file blender/gpu/intern/gpu_immediate_util.c
|
||||||
* \ingroup gpu
|
* \ingroup gpu
|
||||||
*
|
*
|
||||||
* GPU immediate mode drawing utilities
|
* GPU immediate mode drawing utilities
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
#define DEBUG_SHADER_INTERFACE 0
|
#define DEBUG_SHADER_INTERFACE 0
|
||||||
|
|
||||||
#if DEBUG_SHADER_INTERFACE
|
#if DEBUG_SHADER_INTERFACE
|
||||||
#include <stdio.h>
|
# include <stdio.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static const char *BuiltinUniform_name(GPUUniformBuiltin u)
|
static const char *BuiltinUniform_name(GPUUniformBuiltin u)
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
* ***** END GPL LICENSE BLOCK *****
|
* ***** END GPL LICENSE BLOCK *****
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** \file blender/gpu/gpu_vertex_array_id.cpp
|
/** \file blender/gpu/intern/gpu_vertex_array_id.cpp
|
||||||
* \ingroup gpu
|
* \ingroup gpu
|
||||||
*
|
*
|
||||||
* Manage GL vertex array IDs in a thread-safe way
|
* Manage GL vertex array IDs in a thread-safe way
|
||||||
|
@ -58,7 +58,7 @@ static bool thread_is_main() {
|
||||||
|
|
||||||
struct GPUContext {
|
struct GPUContext {
|
||||||
GLuint default_vao;
|
GLuint default_vao;
|
||||||
std::unordered_set<GPUBatch*> batches; /* Batches that have VAOs from this context */
|
std::unordered_set<GPUBatch *> batches; /* Batches that have VAOs from this context */
|
||||||
std::vector<GLuint> orphaned_vertarray_ids;
|
std::vector<GLuint> orphaned_vertarray_ids;
|
||||||
std::mutex orphans_mutex; /* todo: try spinlock instead */
|
std::mutex orphans_mutex; /* todo: try spinlock instead */
|
||||||
#if TRUST_NO_ONE
|
#if TRUST_NO_ONE
|
||||||
|
@ -73,12 +73,12 @@ struct GPUContext {
|
||||||
|
|
||||||
#if defined(_MSC_VER) && (_MSC_VER == 1800)
|
#if defined(_MSC_VER) && (_MSC_VER == 1800)
|
||||||
#define thread_local __declspec(thread)
|
#define thread_local __declspec(thread)
|
||||||
thread_local GPUContext* active_ctx = NULL;
|
thread_local GPUContext *active_ctx = NULL;
|
||||||
#else
|
#else
|
||||||
static thread_local GPUContext* active_ctx = NULL;
|
static thread_local GPUContext *active_ctx = NULL;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void clear_orphans(GPUContext* ctx)
|
static void clear_orphans(GPUContext *ctx)
|
||||||
{
|
{
|
||||||
ctx->orphans_mutex.lock();
|
ctx->orphans_mutex.lock();
|
||||||
if (!ctx->orphaned_vertarray_ids.empty()) {
|
if (!ctx->orphaned_vertarray_ids.empty()) {
|
||||||
|
@ -89,19 +89,19 @@ static void clear_orphans(GPUContext* ctx)
|
||||||
ctx->orphans_mutex.unlock();
|
ctx->orphans_mutex.unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
GPUContext* GPU_context_create(void)
|
GPUContext *GPU_context_create(void)
|
||||||
{
|
{
|
||||||
#if TRUST_NO_ONE
|
#if TRUST_NO_ONE
|
||||||
/* assert(thread_is_main()); */
|
/* assert(thread_is_main()); */
|
||||||
#endif
|
#endif
|
||||||
GPUContext* ctx = new GPUContext;
|
GPUContext *ctx = new GPUContext;
|
||||||
glGenVertexArrays(1, &ctx->default_vao);
|
glGenVertexArrays(1, &ctx->default_vao);
|
||||||
GPU_context_active_set(ctx);
|
GPU_context_active_set(ctx);
|
||||||
return ctx;
|
return ctx;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* to be called after GPU_context_active_set(ctx_to_destroy) */
|
/* to be called after GPU_context_active_set(ctx_to_destroy) */
|
||||||
void GPU_context_discard(GPUContext* ctx)
|
void GPU_context_discard(GPUContext *ctx)
|
||||||
{
|
{
|
||||||
#if TRUST_NO_ONE
|
#if TRUST_NO_ONE
|
||||||
/* Make sure no other thread has locked it. */
|
/* Make sure no other thread has locked it. */
|
||||||
|
@ -120,7 +120,7 @@ void GPU_context_discard(GPUContext* ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ctx can be NULL */
|
/* ctx can be NULL */
|
||||||
void GPU_context_active_set(GPUContext* ctx)
|
void GPU_context_active_set(GPUContext *ctx)
|
||||||
{
|
{
|
||||||
#if TRUST_NO_ONE
|
#if TRUST_NO_ONE
|
||||||
if (active_ctx) {
|
if (active_ctx) {
|
||||||
|
@ -140,7 +140,7 @@ void GPU_context_active_set(GPUContext* ctx)
|
||||||
active_ctx = ctx;
|
active_ctx = ctx;
|
||||||
}
|
}
|
||||||
|
|
||||||
GPUContext* GPU_context_active_get(void)
|
GPUContext *GPU_context_active_get(void)
|
||||||
{
|
{
|
||||||
return active_ctx;
|
return active_ctx;
|
||||||
}
|
}
|
||||||
|
@ -168,7 +168,7 @@ GLuint GPU_vao_alloc(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* this can be called from multiple thread */
|
/* this can be called from multiple thread */
|
||||||
void GPU_vao_free(GLuint vao_id, GPUContext* ctx)
|
void GPU_vao_free(GLuint vao_id, GPUContext *ctx)
|
||||||
{
|
{
|
||||||
#if TRUST_NO_ONE
|
#if TRUST_NO_ONE
|
||||||
assert(ctx);
|
assert(ctx);
|
||||||
|
@ -183,12 +183,12 @@ void GPU_vao_free(GLuint vao_id, GPUContext* ctx)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void gpu_context_add_batch(GPUContext* ctx, GPUBatch* batch)
|
void gpu_context_add_batch(GPUContext *ctx, GPUBatch *batch)
|
||||||
{
|
{
|
||||||
ctx->batches.emplace(batch);
|
ctx->batches.emplace(batch);
|
||||||
}
|
}
|
||||||
|
|
||||||
void gpu_context_remove_batch(GPUContext* ctx, GPUBatch* batch)
|
void gpu_context_remove_batch(GPUContext *ctx, GPUBatch *batch)
|
||||||
{
|
{
|
||||||
ctx->orphans_mutex.lock();
|
ctx->orphans_mutex.lock();
|
||||||
ctx->batches.erase(batch);
|
ctx->batches.erase(batch);
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
#define PACK_DEBUG 0
|
#define PACK_DEBUG 0
|
||||||
|
|
||||||
#if PACK_DEBUG
|
#if PACK_DEBUG
|
||||||
#include <stdio.h>
|
# include <stdio.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void GPU_vertformat_clear(GPUVertFormat *format)
|
void GPU_vertformat_clear(GPUVertFormat *format)
|
||||||
|
|
|
@ -32,8 +32,8 @@
|
||||||
#ifndef __GPU_VERTEX_FORMAT_PRIVATE_H__
|
#ifndef __GPU_VERTEX_FORMAT_PRIVATE_H__
|
||||||
#define __GPU_VERTEX_FORMAT_PRIVATE_H__
|
#define __GPU_VERTEX_FORMAT_PRIVATE_H__
|
||||||
|
|
||||||
void VertexFormat_pack(GPUVertFormat*);
|
void VertexFormat_pack(GPUVertFormat *format);
|
||||||
uint padding(uint offset, uint alignment);
|
uint padding(uint offset, uint alignment);
|
||||||
uint vertex_buffer_size(const GPUVertFormat*, uint vertex_len);
|
uint vertex_buffer_size(const GPUVertFormat *format, uint vertex_len);
|
||||||
|
|
||||||
#endif /* __GPU_VERTEX_FORMAT_PRIVATE_H__ */
|
#endif /* __GPU_VERTEX_FORMAT_PRIVATE_H__ */
|
||||||
|
|
|
@ -6976,8 +6976,9 @@ static void def_cmp_cryptomatte(StructRNA *srna)
|
||||||
|
|
||||||
RNA_def_struct_sdna_from(srna, "NodeCryptomatte", "storage");
|
RNA_def_struct_sdna_from(srna, "NodeCryptomatte", "storage");
|
||||||
prop = RNA_def_property(srna, "matte_id", PROP_STRING, PROP_NONE);
|
prop = RNA_def_property(srna, "matte_id", PROP_STRING, PROP_NONE);
|
||||||
RNA_def_property_string_funcs(prop, "rna_NodeCryptomatte_matte_get", "rna_NodeCryptomatte_matte_length",
|
RNA_def_property_string_funcs(
|
||||||
"rna_NodeCryptomatte_matte_set");
|
prop, "rna_NodeCryptomatte_matte_get", "rna_NodeCryptomatte_matte_length",
|
||||||
|
"rna_NodeCryptomatte_matte_set");
|
||||||
RNA_def_property_ui_text(prop, "Matte Objects", "List of object and material crypto IDs to include in matte");
|
RNA_def_property_ui_text(prop, "Matte Objects", "List of object and material crypto IDs to include in matte");
|
||||||
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
|
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
|
||||||
|
|
||||||
|
|
|
@ -39,10 +39,10 @@
|
||||||
|
|
||||||
static inline float hash_to_float(uint32_t hash)
|
static inline float hash_to_float(uint32_t hash)
|
||||||
{
|
{
|
||||||
uint32_t mantissa = hash & (( 1 << 23) - 1);
|
uint32_t mantissa = hash & ((1 << 23) - 1);
|
||||||
uint32_t exponent = (hash >> 23) & ((1 << 8) - 1);
|
uint32_t exponent = (hash >> 23) & ((1 << 8) - 1);
|
||||||
exponent = MAX2(exponent, (uint32_t) 1);
|
exponent = MAX2(exponent, (uint32_t)1);
|
||||||
exponent = MIN2(exponent, (uint32_t) 254);
|
exponent = MIN2(exponent, (uint32_t)254);
|
||||||
exponent = exponent << 23;
|
exponent = exponent << 23;
|
||||||
uint32_t sign = (hash >> 31);
|
uint32_t sign = (hash >> 31);
|
||||||
sign = sign << 31;
|
sign = sign << 31;
|
||||||
|
@ -54,7 +54,7 @@ static inline float hash_to_float(uint32_t hash)
|
||||||
return f;
|
return f;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void cryptomatte_add(NodeCryptomatte* n, float f)
|
static void cryptomatte_add(NodeCryptomatte *n, float f)
|
||||||
{
|
{
|
||||||
/* Turn the number into a string. */
|
/* Turn the number into a string. */
|
||||||
char number[32];
|
char number[32];
|
||||||
|
@ -72,16 +72,16 @@ static void cryptomatte_add(NodeCryptomatte* n, float f)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Find the next seprator. */
|
/* Find the next seprator. */
|
||||||
char* token_end = strchr(n->matte_id+start, ',');
|
char *token_end = strchr(n->matte_id + start, ',');
|
||||||
if (token_end == NULL || token_end == n->matte_id+start) {
|
if (token_end == NULL || token_end == n->matte_id + start) {
|
||||||
token_end = n->matte_id+end;
|
token_end = n->matte_id + end;
|
||||||
}
|
}
|
||||||
/* Be aware that token_len still contains any trailing white space. */
|
/* Be aware that token_len still contains any trailing white space. */
|
||||||
token_len = token_end - (n->matte_id + start);
|
token_len = token_end - (n->matte_id + start);
|
||||||
|
|
||||||
/* If this has a leading bracket, assume a raw floating point number and look for the closing bracket. */
|
/* If this has a leading bracket, assume a raw floating point number and look for the closing bracket. */
|
||||||
if (n->matte_id[start] == '<') {
|
if (n->matte_id[start] == '<') {
|
||||||
if (strncmp(n->matte_id+start, number, strlen(number)) == 0) {
|
if (strncmp(n->matte_id + start, number, strlen(number)) == 0) {
|
||||||
/* This number is already there, so continue. */
|
/* This number is already there, so continue. */
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -89,16 +89,16 @@ static void cryptomatte_add(NodeCryptomatte* n, float f)
|
||||||
else {
|
else {
|
||||||
/* Remove trailing white space */
|
/* Remove trailing white space */
|
||||||
size_t name_len = token_len;
|
size_t name_len = token_len;
|
||||||
while (n->matte_id[start+name_len] == ' ' && name_len > 0) {
|
while (n->matte_id[start + name_len] == ' ' && name_len > 0) {
|
||||||
name_len--;
|
name_len--;
|
||||||
}
|
}
|
||||||
/* Calculate the hash of the token and compare. */
|
/* Calculate the hash of the token and compare. */
|
||||||
uint32_t hash = BLI_hash_mm3((const unsigned char*)(n->matte_id+start), name_len, 0);
|
uint32_t hash = BLI_hash_mm3((const unsigned char *)(n->matte_id + start), name_len, 0);
|
||||||
if (f == hash_to_float(hash)) {
|
if (f == hash_to_float(hash)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
start += token_len+1;
|
start += token_len + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -107,12 +107,12 @@ static void cryptomatte_add(NodeCryptomatte* n, float f)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(n->matte_id) {
|
if (n->matte_id) {
|
||||||
BLI_dynstr_append(new_matte, n->matte_id);
|
BLI_dynstr_append(new_matte, n->matte_id);
|
||||||
MEM_freeN(n->matte_id);
|
MEM_freeN(n->matte_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(BLI_dynstr_get_len(new_matte) > 0) {
|
if (BLI_dynstr_get_len(new_matte) > 0) {
|
||||||
BLI_dynstr_append(new_matte, ",");
|
BLI_dynstr_append(new_matte, ",");
|
||||||
}
|
}
|
||||||
BLI_dynstr_append(new_matte, number);
|
BLI_dynstr_append(new_matte, number);
|
||||||
|
@ -120,7 +120,7 @@ static void cryptomatte_add(NodeCryptomatte* n, float f)
|
||||||
BLI_dynstr_free(new_matte);
|
BLI_dynstr_free(new_matte);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void cryptomatte_remove(NodeCryptomatte*n, float f)
|
static void cryptomatte_remove(NodeCryptomatte *n, float f)
|
||||||
{
|
{
|
||||||
if (n->matte_id == NULL || strlen(n->matte_id) == 0) {
|
if (n->matte_id == NULL || strlen(n->matte_id) == 0) {
|
||||||
/* Empty string, nothing to remove. */
|
/* Empty string, nothing to remove. */
|
||||||
|
@ -150,9 +150,9 @@ static void cryptomatte_remove(NodeCryptomatte*n, float f)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Find the next seprator. */
|
/* Find the next seprator. */
|
||||||
char* token_end = strchr(n->matte_id+start+1, ',');
|
char *token_end = strchr(n->matte_id + start + 1, ',');
|
||||||
if (token_end == NULL || token_end == n->matte_id+start) {
|
if (token_end == NULL || token_end == n->matte_id + start) {
|
||||||
token_end = n->matte_id+end;
|
token_end = n->matte_id + end;
|
||||||
}
|
}
|
||||||
/* Be aware that token_len still contains any trailing white space. */
|
/* Be aware that token_len still contains any trailing white space. */
|
||||||
token_len = token_end - (n->matte_id + start);
|
token_len = token_end - (n->matte_id + start);
|
||||||
|
@ -162,7 +162,7 @@ static void cryptomatte_remove(NodeCryptomatte*n, float f)
|
||||||
}
|
}
|
||||||
/* If this has a leading bracket, assume a raw floating point number and look for the closing bracket. */
|
/* If this has a leading bracket, assume a raw floating point number and look for the closing bracket. */
|
||||||
else if (n->matte_id[start] == '<') {
|
else if (n->matte_id[start] == '<') {
|
||||||
if (strncmp(n->matte_id+start, number, strlen(number)) == 0) {
|
if (strncmp(n->matte_id + start, number, strlen(number)) == 0) {
|
||||||
/* This number is already there, so skip it. */
|
/* This number is already there, so skip it. */
|
||||||
skip = true;
|
skip = true;
|
||||||
}
|
}
|
||||||
|
@ -170,11 +170,11 @@ static void cryptomatte_remove(NodeCryptomatte*n, float f)
|
||||||
else {
|
else {
|
||||||
/* Remove trailing white space */
|
/* Remove trailing white space */
|
||||||
size_t name_len = token_len;
|
size_t name_len = token_len;
|
||||||
while (n->matte_id[start+name_len] == ' ' && name_len > 0) {
|
while (n->matte_id[start + name_len] == ' ' && name_len > 0) {
|
||||||
name_len--;
|
name_len--;
|
||||||
}
|
}
|
||||||
/* Calculate the hash of the token and compare. */
|
/* Calculate the hash of the token and compare. */
|
||||||
uint32_t hash = BLI_hash_mm3((const unsigned char*)(n->matte_id+start), name_len, 0);
|
uint32_t hash = BLI_hash_mm3((const unsigned char *)(n->matte_id + start), name_len, 0);
|
||||||
if (f == hash_to_float(hash)) {
|
if (f == hash_to_float(hash)) {
|
||||||
skip = true;
|
skip = true;
|
||||||
}
|
}
|
||||||
|
@ -186,26 +186,26 @@ static void cryptomatte_remove(NodeCryptomatte*n, float f)
|
||||||
else {
|
else {
|
||||||
BLI_dynstr_append(new_matte, ", ");
|
BLI_dynstr_append(new_matte, ", ");
|
||||||
}
|
}
|
||||||
BLI_dynstr_nappend(new_matte, n->matte_id+start, token_len);
|
BLI_dynstr_nappend(new_matte, n->matte_id + start, token_len);
|
||||||
}
|
}
|
||||||
start += token_len+1;
|
start += token_len + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(n->matte_id) {
|
if (n->matte_id) {
|
||||||
MEM_freeN(n->matte_id);
|
MEM_freeN(n->matte_id);
|
||||||
n->matte_id = NULL;
|
n->matte_id = NULL;
|
||||||
}
|
}
|
||||||
if(BLI_dynstr_get_len(new_matte) > 0) {
|
if (BLI_dynstr_get_len(new_matte) > 0) {
|
||||||
n->matte_id = BLI_dynstr_get_cstring(new_matte);
|
n->matte_id = BLI_dynstr_get_cstring(new_matte);
|
||||||
}
|
}
|
||||||
BLI_dynstr_free(new_matte);
|
BLI_dynstr_free(new_matte);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bNodeSocketTemplate outputs[] = {
|
static bNodeSocketTemplate outputs[] = {
|
||||||
{ SOCK_RGBA, 0, N_("Image")},
|
{ SOCK_RGBA, 0, N_("Image")},
|
||||||
{ SOCK_FLOAT, 0, N_("Matte")},
|
{ SOCK_FLOAT, 0, N_("Matte")},
|
||||||
{ SOCK_RGBA, 0, N_("Pick")},
|
{ SOCK_RGBA, 0, N_("Pick")},
|
||||||
{ -1, 0, "" }
|
{ -1, 0, "" }
|
||||||
};
|
};
|
||||||
|
|
||||||
void ntreeCompositCryptomatteSyncFromAdd(bNodeTree *UNUSED(ntree), bNode *node)
|
void ntreeCompositCryptomatteSyncFromAdd(bNodeTree *UNUSED(ntree), bNode *node)
|
||||||
|
@ -235,7 +235,7 @@ bNodeSocket *ntreeCompositCryptomatteAddSocket(bNodeTree *ntree, bNode *node)
|
||||||
NodeCryptomatte *n = node->storage;
|
NodeCryptomatte *n = node->storage;
|
||||||
char sockname[32];
|
char sockname[32];
|
||||||
n->num_inputs++;
|
n->num_inputs++;
|
||||||
BLI_snprintf(sockname, sizeof(sockname), "Crypto %.2d", n->num_inputs-1);
|
BLI_snprintf(sockname, sizeof(sockname), "Crypto %.2d", n->num_inputs - 1);
|
||||||
bNodeSocket *sock = nodeAddStaticSocket(ntree, node, SOCK_IN, SOCK_RGBA, PROP_NONE, NULL, sockname);
|
bNodeSocket *sock = nodeAddStaticSocket(ntree, node, SOCK_IN, SOCK_RGBA, PROP_NONE, NULL, sockname);
|
||||||
return sock;
|
return sock;
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,7 @@ static bNodeSocketTemplate sh_node_bsdf_hair_principled_in[] = {
|
||||||
{ SOCK_FLOAT, 1, N_("Radial Roughness"), 0.3f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
|
{ SOCK_FLOAT, 1, N_("Radial Roughness"), 0.3f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
|
||||||
{ SOCK_FLOAT, 1, N_("Coat"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
|
{ SOCK_FLOAT, 1, N_("Coat"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
|
||||||
{ SOCK_FLOAT, 1, N_("IOR"), 1.55f, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f},
|
{ SOCK_FLOAT, 1, N_("IOR"), 1.55f, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f},
|
||||||
{ SOCK_FLOAT, 1, N_("Offset"), 2.f*((float)M_PI)/180.f, 0.0f, 0.0f, 0.0f, -M_PI_2, M_PI_2, PROP_ANGLE},
|
{ SOCK_FLOAT, 1, N_("Offset"), 2.0f * ((float)M_PI) / 180.f, 0.0f, 0.0f, 0.0f, -M_PI_2, M_PI_2, PROP_ANGLE},
|
||||||
{ SOCK_FLOAT, 1, N_("Random Color"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
|
{ SOCK_FLOAT, 1, N_("Random Color"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
|
||||||
{ SOCK_FLOAT, 1, N_("Random Roughness"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
|
{ SOCK_FLOAT, 1, N_("Random Roughness"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
|
||||||
{ SOCK_FLOAT, 1, N_("Random"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE},
|
{ SOCK_FLOAT, 1, N_("Random"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE},
|
||||||
|
|
|
@ -32,8 +32,6 @@
|
||||||
|
|
||||||
#include "BLI_math.h"
|
#include "BLI_math.h"
|
||||||
|
|
||||||
#include "GPU_batch.h"
|
|
||||||
|
|
||||||
#include "MEM_guardedalloc.h"
|
#include "MEM_guardedalloc.h"
|
||||||
|
|
||||||
#include "../generic/py_capi_utils.h"
|
#include "../generic/py_capi_utils.h"
|
||||||
|
|
Loading…
Reference in New Issue