Skip to content

Commit d208d25

Browse files
committed
Merge branch 'master' into HEAD
2 parents 2479dd7 + 2b81ab7 commit d208d25

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+1561
-593
lines changed

CMakeLists.txt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -99,15 +99,15 @@ option(WITH_CUDA_DYNLOAD "Dynamically load CUDA libraries at runtime"
9999
mark_as_advanced(WITH_CUDA_DYNLOAD)
100100

101101
# ====== Tangent Rez Deps
102-
option(BUILD_WITH_REZ "Build with rez" ON)
103-
option(BUILD_WITH_HOUDINI "Build with houdini" OFF)
104-
105-
if(${BUILD_WITH_REZ})
102+
if(DEFINED ENV{TA_USING_REZ})
103+
message(STATUS "Building with REZ")
106104
include(src/cmake/rez_deps.cmake)
107-
elseif(${BUILD_WITH_HOUDINI})
108-
include(src/cmake/hou_deps.cmake)
109-
elseif(${BUILD_WITH_USD})
110-
include(src/cmake/pxr_deps.cmake)
105+
elseif(DEFINED HOUDINI_ROOT)
106+
message(STATUS "Building with Houdini")
107+
include(src/cmake/hou_deps.cmake)
108+
elseif(DEFINED USD_ROOT)
109+
message(STATUS "Building with Pixar")
110+
include(src/cmake/pxr_deps.cmake)
111111
else()
112112
set(USE_OPENGL TRUE)
113113
add_definitions(-DUSE_OPENGL)

package.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
name = 'cycles'
44

5-
version = '1.13.0-ta.1.12.0'
5+
6+
version = '1.13.0-ta.1.14.7'
67

78
authors = [
89
'benjamin.skinner',

src/CMakeLists.txt

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,13 +405,24 @@ endif()
405405

406406
if(WITH_CYCLES_STANDALONE)
407407
add_library(Cycles INTERFACE)
408+
add_library(Cycles::Cycles ALIAS Cycles)
408409

409410
target_include_directories(Cycles
410411
INTERFACE
411-
$<BUILD_INTERFACE:.>
412+
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
413+
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../third_party/atomic>
412414
$<INSTALL_INTERFACE:include>
413415
)
414416

417+
target_link_libraries(Cycles
418+
INTERFACE
419+
$<BUILD_INTERFACE:${OPENEXR_HALF_LIBRARY}>
420+
$<BUILD_INTERFACE:${OPENIMAGEIO_LIBRARY}>
421+
$<BUILD_INTERFACE:${OPENCOLORIO_OPENCOLORIO_LIBRARY}>
422+
$<BUILD_INTERFACE:${OPENSUBDIV_OSDGPU_LIBRARY}>
423+
$<BUILD_INTERFACE:${OPENSUBDIV_OSDCPU_LIBRARY}>
424+
)
425+
415426
target_link_libraries(Cycles
416427
INTERFACE
417428
extern_sky
@@ -423,6 +434,7 @@ if(WITH_CYCLES_STANDALONE)
423434
cycles_device
424435
cycles_subd
425436
cycles_kernel
437+
cycles_graph
426438
)
427439

428440
# create target export and install actual targets

src/app/cycles_xml.cpp

Lines changed: 138 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,17 @@ static void xml_read_camera(XMLReadState &state, xml_node node)
202202

203203
cam->need_update = true;
204204
cam->update(state.scene);
205+
206+
// dicing camera
207+
Camera *dicing_cam = state.scene->dicing_camera;
208+
dicing_cam->width = cam->width;
209+
dicing_cam->height = cam->height;
210+
dicing_cam->full_width = cam->full_width;
211+
dicing_cam->full_height = cam->full_height;
212+
213+
dicing_cam->matrix = state.tfm;
214+
dicing_cam->need_update = true;
215+
dicing_cam->update(state.scene);
205216
}
206217

207218
/* Shader */
@@ -391,6 +402,122 @@ static Mesh *xml_add_mesh(Scene *scene, const Transform &tfm)
391402
return mesh;
392403
}
393404

405+
static void xml_read_mesh_attributes(const XMLReadState &state, Mesh *mesh, xml_node attribute_node)
406+
{
407+
AttributeSet &attributes = mesh->subdivision_type == Mesh::SUBDIVISION_NONE ?
408+
mesh->attributes :
409+
mesh->subd_attributes;
410+
411+
xml_attribute name_attr = attribute_node.attribute("name");
412+
if (!name_attr) {
413+
return;
414+
}
415+
416+
if (state.scene->integrator->motion_blur
417+
&& string_iequals(name_attr.value(), "motion_vertex_position")) {
418+
vector<float3> data;
419+
420+
if (xml_read_float3_array(data, attribute_node, "data")) {
421+
if (data.size() % mesh->verts.size() != 0) {
422+
return;
423+
}
424+
425+
mesh->motion_steps = 1 + data.size() / mesh->verts.size();
426+
mesh->use_motion_blur = true;
427+
428+
Attribute *motion_vertex_position = attributes.add(ATTR_STD_MOTION_VERTEX_POSITION);
429+
float3 *motion = motion_vertex_position->data_float3();
430+
431+
for (size_t i = 0; i < data.size(); ++i) {
432+
motion[i] = data[i];
433+
}
434+
}
435+
}
436+
437+
xml_attribute data_attr = attribute_node.attribute("data");
438+
if (!data_attr) {
439+
return;
440+
}
441+
442+
// TODO: add support for standard attributes such as P, UV etc
443+
444+
// custom attribute
445+
xml_attribute type_attr = attribute_node.attribute("type");
446+
xml_attribute elem_attr = attribute_node.attribute("element");
447+
if (!type_attr || !elem_attr) {
448+
return;
449+
}
450+
451+
// type
452+
TypeDesc type_desc = TypeUnknown;
453+
int type_size = 0;
454+
if (string_iequals(type_attr.value(), "float")) {
455+
type_desc = TypeFloat;
456+
type_size = 1;
457+
}
458+
else if (string_iequals(type_attr.value(), "float2")) {
459+
type_desc = TypeFloat2;
460+
type_size = 2;
461+
}
462+
else if (string_iequals(type_attr.value(), "color")) {
463+
type_desc = TypeColor;
464+
type_size = 3;
465+
}
466+
467+
if (type_desc == TypeUnknown) {
468+
fprintf(stderr, "Unknown attribute type \"%s\".\n", name_attr.value());
469+
return;
470+
}
471+
472+
// element
473+
AttributeElement element = AttributeElement::ATTR_ELEMENT_NONE;
474+
if (string_iequals(elem_attr.value(), "vertex")) {
475+
element = AttributeElement::ATTR_ELEMENT_VERTEX;
476+
}
477+
if (string_iequals(elem_attr.value(), "face")) {
478+
element = AttributeElement::ATTR_ELEMENT_FACE;
479+
}
480+
if (string_iequals(elem_attr.value(), "corner")) {
481+
element = AttributeElement::ATTR_ELEMENT_CORNER;
482+
}
483+
484+
// unknown element
485+
if (element == AttributeElement::ATTR_ELEMENT_NONE) {
486+
fprintf(stderr, "Unknown attribute element \"%s\".\n", name_attr.value());
487+
return;
488+
}
489+
490+
// create
491+
vector<float> data;
492+
if (xml_read_float_array(data, attribute_node, "data")) {
493+
auto size = mesh->element_size(element, attributes.prim);
494+
if (data.size() != size * type_size) {
495+
fprintf(stderr, "Invalid attribute size \"%s\".\n", name_attr.value());
496+
return;
497+
}
498+
499+
Attribute *attrib = attributes.add(ustring{name_attr.value()}, type_desc, element);
500+
if (type_desc == TypeFloat) {
501+
auto adata = attrib->data_float();
502+
for (size_t i = 0; i < size; ++i) {
503+
adata[i] = data[i];
504+
}
505+
}
506+
else if (type_desc == TypeFloat2) {
507+
auto adata = attrib->data_float2();
508+
for (size_t i = 0, o = 0; i < size; ++i, o += type_size) {
509+
adata[i] = make_float2(data[o], data[o + 1]);
510+
}
511+
}
512+
else if (type_desc == TypeColor) {
513+
auto adata = attrib->data_float3();
514+
for (size_t i = 0, o = 0; i < size; ++i, o += type_size) {
515+
adata[i] = make_float3(data[o], data[o + 1], data[o + 2]);
516+
}
517+
}
518+
}
519+
}
520+
394521
static void xml_read_mesh(const XMLReadState &state, xml_node node)
395522
{
396523
/* add mesh */
@@ -460,7 +587,6 @@ static void xml_read_mesh(const XMLReadState &state, xml_node node)
460587

461588
assert(v0 * 2 + 1 < (int)UV.size());
462589
assert(v1 * 2 + 1 < (int)UV.size());
463-
assert(v2 * 2 + 1 < (int)UV.size());
464590

465591
fdata[0] = make_float2(UV[v0 * 2], UV[v0 * 2 + 1]);
466592
fdata[1] = make_float2(UV[v1 * 2], UV[v1 * 2 + 1]);
@@ -496,7 +622,7 @@ static void xml_read_mesh(const XMLReadState &state, xml_node node)
496622
if (xml_read_float_array(UV, node, "UV")) {
497623
ustring name = ustring("UVMap");
498624
Attribute *attr = mesh->subd_attributes.add(ATTR_STD_UV, name);
499-
float3 *fdata = attr->data_float3();
625+
float2 *fdata = attr->data_float2();
500626

501627
#if 0
502628
if (subdivide_uvs) {
@@ -507,7 +633,9 @@ static void xml_read_mesh(const XMLReadState &state, xml_node node)
507633
index_offset = 0;
508634
for (size_t i = 0; i < nverts.size(); i++) {
509635
for (int j = 0; j < nverts[i]; j++) {
510-
*(fdata++) = make_float3(UV[index_offset++]);
636+
auto u = UV[index_offset++];
637+
auto v = UV[index_offset++];
638+
*(fdata++) = make_float2(u, v);
511639
}
512640
}
513641
}
@@ -525,6 +653,13 @@ static void xml_read_mesh(const XMLReadState &state, xml_node node)
525653
sdparams.objecttoworld = state.tfm;
526654
}
527655

656+
for (xml_node child_node = node.first_child(); child_node;
657+
child_node = child_node.next_sibling()) {
658+
if (string_iequals(child_node.name(), "attribute")) {
659+
xml_read_mesh_attributes(state, mesh, child_node);
660+
}
661+
}
662+
528663
/* we don't yet support arbitrary attributes, for now add vertex
529664
* coordinates as generated coordinates if requested */
530665
if (mesh->need_attribute(state.scene, ATTR_STD_GENERATED)) {

src/blender/addon/engine.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,14 @@ def list_render_passes(scene, srl):
291291
if any(getattr(crl, option) for option in clean_options):
292292
yield ("Denoising Clean", "RGB", 'COLOR')
293293

294+
# Light groups.
295+
lightgroup_names = []
296+
for lightgroup in crl.lightgroups:
297+
name = lightgroup.name
298+
if (lightgroup.collection or lightgroup.include_world) and not name in lightgroup_names:
299+
yield (name + ".Combined", "RGB", 'COLOR')
300+
lightgroup_names.append(name)
301+
294302
# Custom AOV passes.
295303
for aov in crl.aovs:
296304
if aov.type == 'VALUE':

src/blender/addon/operators.py

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,87 @@ def execute(self, context):
7474
return {'FINISHED'}
7575

7676

77+
class CYCLES_OT_lightgroup_add(bpy.types.Operator):
78+
"""Add a lightgroup"""
79+
bl_idname="cycles.lightgroup_add"
80+
bl_label="Add Lightgroup"
81+
82+
def execute(self, context):
83+
view_layer = context.view_layer
84+
cycles_view_layer = view_layer.cycles
85+
lgs = cycles_view_layer.lightgroups
86+
87+
new_lg = lgs.add()
88+
89+
number = 0
90+
name = "Lightgroup"
91+
while name in lgs.keys():
92+
number = number + 1
93+
name = "Lightgroup.{:03d}".format(number)
94+
new_lg.name = name
95+
96+
cycles_view_layer.active_lightgroup = len(lgs) - 1
97+
98+
view_layer.update_render_passes()
99+
return {'FINISHED'}
100+
101+
102+
class CYCLES_OT_lightgroup_remove(bpy.types.Operator):
103+
"""Remove a lightgroup"""
104+
bl_idname="cycles.lightgroup_remove"
105+
bl_label="Remove Lightgroup"
106+
107+
def execute(self, context):
108+
view_layer = context.view_layer
109+
cycles_view_layer = view_layer.cycles
110+
lgs = cycles_view_layer.lightgroups
111+
112+
cycles_view_layer.lightgroups.remove(cycles_view_layer.active_lightgroup)
113+
114+
if cycles_view_layer.active_lightgroup >= len(lgs):
115+
cycles_view_layer.active_lightgroup = max(len(lgs) - 1, 0)
116+
117+
view_layer.update_render_passes()
118+
return {'FINISHED'}
119+
120+
121+
class CYCLES_OT_lightgroup_move(bpy.types.Operator):
122+
bl_idname = "cycles.lightgroup_move"
123+
bl_label = "Move Lightgroup"
124+
125+
direction: bpy.props.EnumProperty(
126+
name="Move Direction",
127+
description="Direction to move the active Lightgroup: UP (default) or DOWN",
128+
items=[
129+
('UP', "Up", "", -1),
130+
('DOWN', "Down", "", 1),
131+
],
132+
default='UP',
133+
options={'HIDDEN'},
134+
)
135+
136+
@classmethod
137+
def poll(cls, context):
138+
view_layer = context.view_layer
139+
cycles_view_layer = view_layer.cycles
140+
return len(cycles_view_layer.lightgroups) > 1
141+
142+
def execute(self, context):
143+
view_layer = context.view_layer
144+
cycles_view_layer = view_layer.cycles
145+
146+
active_idx = cycles_view_layer.active_lightgroup
147+
new_idx = active_idx + (-1 if self.direction == 'UP' else 1)
148+
149+
if new_idx < 0 or new_idx >= len(cycles_view_layer.lightgroups):
150+
return {'FINISHED'}
151+
152+
cycles_view_layer.lightgroups.move(active_idx, new_idx)
153+
cycles_view_layer.active_lightgroup = new_idx
154+
155+
return {'FINISHED'}
156+
157+
77158
class CYCLES_OT_denoise_animation(Operator):
78159
"Denoise rendered animation sequence using current scene and view " \
79160
"layer settings. Requires denoising data passes and output to " \
@@ -200,6 +281,9 @@ def execute(self, context):
200281
CYCLES_OT_add_aov,
201282
CYCLES_OT_remove_aov,
202283
CYCLES_OT_denoise_animation,
284+
CYCLES_OT_lightgroup_add,
285+
CYCLES_OT_lightgroup_remove,
286+
CYCLES_OT_lightgroup_move,
203287
CYCLES_OT_merge_images
204288
)
205289

0 commit comments

Comments
 (0)