Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/app/cycles_xml.cpp
| /* SPDX-License-Identifier: Apache-2.0 | /* SPDX-License-Identifier: Apache-2.0 | ||||
| * Copyright 2011-2022 Blender Foundation */ | * Copyright 2011-2022 Blender Foundation */ | ||||
| #include <stdio.h> | #include <stdio.h> | ||||
| #include <algorithm> | #include <algorithm> | ||||
| #include <iterator> | #include <iterator> | ||||
| #include <sstream> | #include <sstream> | ||||
| #include "graph/node_xml.h" | #include "graph/node_xml.h" | ||||
| #include "scene/alembic.h" | |||||
| #include "scene/background.h" | #include "scene/background.h" | ||||
| #include "scene/camera.h" | #include "scene/camera.h" | ||||
| #include "scene/film.h" | #include "scene/film.h" | ||||
| #include "scene/integrator.h" | #include "scene/integrator.h" | ||||
| #include "scene/light.h" | #include "scene/light.h" | ||||
| #include "scene/mesh.h" | #include "scene/mesh.h" | ||||
| #include "scene/object.h" | #include "scene/object.h" | ||||
| #include "scene/osl.h" | #include "scene/osl.h" | ||||
| ▲ Show 20 Lines • Show All 167 Lines • ▼ Show 20 Lines | static void xml_read_camera(XMLReadState &state, xml_node node) | ||||
| xml_read_node(state, cam, node); | xml_read_node(state, cam, node); | ||||
| cam->set_matrix(state.tfm); | cam->set_matrix(state.tfm); | ||||
| cam->need_flags_update = true; | cam->need_flags_update = true; | ||||
| cam->update(state.scene); | cam->update(state.scene); | ||||
| } | } | ||||
| /* Alembic */ | |||||
| #ifdef WITH_ALEMBIC | |||||
| static void xml_read_alembic(XMLReadState &state, xml_node graph_node) | |||||
| { | |||||
| AlembicProcedural *proc = state.scene->create_node<AlembicProcedural>(); | |||||
| xml_read_node(state, proc, graph_node); | |||||
| for (xml_node node = graph_node.first_child(); node; node = node.next_sibling()) { | |||||
| if (string_iequals(node.name(), "object")) { | |||||
| string path; | |||||
| if (xml_read_string(&path, node, "path")) { | |||||
brecht: Use `string_iequals` and don't convert unnecessarily to `ustring` here. | |||||
| ustring object_path(path, 0); | |||||
| AlembicObject *object = static_cast<AlembicObject *>( | |||||
| proc->get_or_create_object(object_path)); | |||||
| array<Node *> used_shaders = object->get_used_shaders(); | |||||
| used_shaders.push_back_slow(state.shader); | |||||
| object->set_used_shaders(used_shaders); | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| #endif | |||||
| /* Shader */ | /* Shader */ | ||||
| static void xml_read_shader_graph(XMLReadState &state, Shader *shader, xml_node graph_node) | static void xml_read_shader_graph(XMLReadState &state, Shader *shader, xml_node graph_node) | ||||
| { | { | ||||
| xml_read_node(state, shader, graph_node); | xml_read_node(state, shader, graph_node); | ||||
| ShaderGraph *graph = new ShaderGraph(); | ShaderGraph *graph = new ShaderGraph(); | ||||
| ▲ Show 20 Lines • Show All 439 Lines • ▼ Show 20 Lines | else if (string_iequals(node.name(), "state")) { | ||||
| xml_read_scene(substate, node); | xml_read_scene(substate, node); | ||||
| } | } | ||||
| else if (string_iequals(node.name(), "include")) { | else if (string_iequals(node.name(), "include")) { | ||||
| string src; | string src; | ||||
| if (xml_read_string(&src, node, "src")) | if (xml_read_string(&src, node, "src")) | ||||
| xml_read_include(state, src); | xml_read_include(state, src); | ||||
| } | } | ||||
| #ifdef WITH_ALEMBIC | |||||
| else if (string_iequals(node.name(), "alembic")) { | |||||
| xml_read_alembic(state, node); | |||||
| } | |||||
| #endif | |||||
| else | else | ||||
| fprintf(stderr, "Unknown node \"%s\".\n", node.name()); | fprintf(stderr, "Unknown node \"%s\".\n", node.name()); | ||||
| } | } | ||||
| } | } | ||||
| /* Include */ | /* Include */ | ||||
| static void xml_read_include(XMLReadState &state, const string &src) | static void xml_read_include(XMLReadState &state, const string &src) | ||||
| Show All 40 Lines | |||||
Use string_iequals and don't convert unnecessarily to ustring here.