diff options
author | Jacques Lucke <jacques@blender.org> | 2022-01-04 15:38:02 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2022-01-04 15:38:02 +0300 |
commit | 3f3adef4a07df05fe92e0b948d4e2bc48f5ec3fc (patch) | |
tree | bd663322534a595e3e07bf37bce66fb7d177fe2b | |
parent | c5b55a84f58aebc302de66fff13816d4beda38ee (diff) | |
parent | b2867d436585bf7ff92f1d7e9a0de9bb5ede006b (diff) |
Merge branch 'master' into temp-copy-on-writetemp-copy-on-write
440 files changed, 4729 insertions, 590 deletions
diff --git a/build_files/build_environment/install_deps.sh b/build_files/build_environment/install_deps.sh index 2936ab1ed8e..c38973b274f 100755 --- a/build_files/build_environment/install_deps.sh +++ b/build_files/build_environment/install_deps.sh @@ -5801,7 +5801,7 @@ print_info() { PRINT "If you're using CMake add this to your configuration flags:" _buildargs="-U *SNDFILE* -U PYTHON* -U *BOOST* -U *Boost* -U *TBB*" - _buildargs="$_buildargs -U *OPENCOLORIO* -U *OPENEXR* -U *OPENIMAGEIO* -U *LLVM* -U *CYCLES*" + _buildargs="$_buildargs -U *OPENCOLORIO* -U *OPENEXR* -U *OPENIMAGEIO* -U *LLVM* -U *CLANG* -U *CYCLES*" _buildargs="$_buildargs -U *OPENSUBDIV* -U *OPENVDB* -U *BLOSC* -U *COLLADA* -U *FFMPEG* -U *ALEMBIC* -U *USD*" _buildargs="$_buildargs -U *EMBREE* -U *OPENIMAGEDENOISE* -U *OPENXR*" diff --git a/intern/cycles/kernel/types.h b/intern/cycles/kernel/types.h index 20abea37649..1d0537f9547 100644 --- a/intern/cycles/kernel/types.h +++ b/intern/cycles/kernel/types.h @@ -202,7 +202,7 @@ enum SamplingPattern { /* These flags values correspond to `raytypes` in `osl.cpp`, so keep them in sync! */ -enum PathRayFlag { +enum PathRayFlag : uint32_t { /* -------------------------------------------------------------------- * Ray visibility. * @@ -1559,7 +1559,7 @@ enum { /* Kernel Features */ -enum KernelFeatureFlag : unsigned int { +enum KernelFeatureFlag : uint32_t { /* Shader nodes. */ KERNEL_FEATURE_NODE_BSDF = (1U << 0U), KERNEL_FEATURE_NODE_EMISSION = (1U << 1U), diff --git a/intern/cycles/scene/shader_nodes.cpp b/intern/cycles/scene/shader_nodes.cpp index c345d5bbc9a..e8316ad41b4 100644 --- a/intern/cycles/scene/shader_nodes.cpp +++ b/intern/cycles/scene/shader_nodes.cpp @@ -5901,7 +5901,7 @@ VectorMapRangeNode::VectorMapRangeNode() : ShaderNode(get_node_type()) { } -void VectorMapRangeNode::expand(ShaderGraph *graph) +void VectorMapRangeNode::expand(ShaderGraph * /*graph*/) { } diff --git a/release/datafiles/fonts/droidsans.ttf b/release/datafiles/fonts/droidsans.ttf Binary files differindex eea72f53ccd..b03e47f087e 100644 --- a/release/datafiles/fonts/droidsans.ttf +++ b/release/datafiles/fonts/droidsans.ttf diff --git a/release/scripts/modules/bl_i18n_utils/settings.py b/release/scripts/modules/bl_i18n_utils/settings.py index ac932fe38dc..bdc345ee50a 100644 --- a/release/scripts/modules/bl_i18n_utils/settings.py +++ b/release/scripts/modules/bl_i18n_utils/settings.py @@ -100,6 +100,7 @@ LANGUAGES = ( (45, "Abkhaz (Аԥсуа бызшәа)", "ab"), (46, "Thai (ภาษาไทย)", "th_TH"), (47, "Slovak (Slovenčina)", "sk_SK"), + (48, "Georgian (ქართული)", "ka"), ) # Default context, in py (keep in sync with `BLT_translation.h`)! diff --git a/release/scripts/modules/bl_i18n_utils/utils.py b/release/scripts/modules/bl_i18n_utils/utils.py index e13eb15dfd2..2e0113051a5 100644 --- a/release/scripts/modules/bl_i18n_utils/utils.py +++ b/release/scripts/modules/bl_i18n_utils/utils.py @@ -1135,6 +1135,7 @@ class I18nMessages: # XXX Temp solution, until I can make own mo generator working... import subprocess with tempfile.NamedTemporaryFile(mode='w+', encoding="utf-8") as tmp_po_f: + os.makedirs(os.path.dirname(fname), exist_ok=True) self.write_messages_to_po(tmp_po_f) cmd = ( self.settings.GETTEXT_MSGFMT_EXECUTABLE, diff --git a/release/scripts/startup/bl_ui/space_topbar.py b/release/scripts/startup/bl_ui/space_topbar.py index 3137ac43549..99abc60db6f 100644 --- a/release/scripts/startup/bl_ui/space_topbar.py +++ b/release/scripts/startup/bl_ui/space_topbar.py @@ -481,6 +481,7 @@ class TOPBAR_MT_file_export(Menu): bl_owner_use_filter = False def draw(self, _context): + self.layout.operator("wm.obj_export", text="Wavefront OBJ (.obj) - New") if bpy.app.build_options.collada: self.layout.operator("wm.collada_export", text="Collada (Default) (.dae)") diff --git a/release/scripts/startup/nodeitems_builtins.py b/release/scripts/startup/nodeitems_builtins.py index e7d7d7b2390..6ce11e1eace 100644 --- a/release/scripts/startup/nodeitems_builtins.py +++ b/release/scripts/startup/nodeitems_builtins.py @@ -150,6 +150,7 @@ def mesh_node_items(context): yield NodeItem("GeometryNodeSubdivisionSurface") yield NodeItem("GeometryNodeTriangulate") yield NodeItemCustom(draw=lambda self, layout, context: layout.separator()) + yield NodeItem("GeometryNodeInputMeshEdgeAngle") yield NodeItem("GeometryNodeInputMeshEdgeNeighbors") yield NodeItem("GeometryNodeInputMeshEdgeVertices") yield NodeItem("GeometryNodeInputMeshFaceArea") diff --git a/source/blender/blenkernel/BKE_geometry_set.hh b/source/blender/blenkernel/BKE_geometry_set.hh index d5a5044d7ad..e479a46bd5b 100644 --- a/source/blender/blenkernel/BKE_geometry_set.hh +++ b/source/blender/blenkernel/BKE_geometry_set.hh @@ -930,9 +930,10 @@ class InstancesComponent : public GeometryComponent { int references_amount() const; /** - * Remove the indices in the selection mask and remove unused instance references afterwards. + * Remove the indices that are not contained in the mask input, and remove unused instance + * references afterwards. */ - void remove_instances(const blender::IndexMask selection); + void remove_instances(const blender::IndexMask mask); blender::Span<int> almost_unique_ids() const; diff --git a/source/blender/blenkernel/BKE_node.h b/source/blender/blenkernel/BKE_node.h index 8bc4292448d..56b44994985 100644 --- a/source/blender/blenkernel/BKE_node.h +++ b/source/blender/blenkernel/BKE_node.h @@ -969,9 +969,11 @@ bool nodeGroupPoll(struct bNodeTree *nodetree, /** * Initialize a new node type struct with default values and callbacks. */ -void node_type_base(struct bNodeType *ntype, int type, const char *name, short nclass, short flag); -void node_type_base_custom( - struct bNodeType *ntype, const char *idname, const char *name, short nclass, short flag); +void node_type_base(struct bNodeType *ntype, int type, const char *name, short nclass); +void node_type_base_custom(struct bNodeType *ntype, + const char *idname, + const char *name, + short nclass); void node_type_socket_templates(struct bNodeType *ntype, struct bNodeSocketTemplate *inputs, struct bNodeSocketTemplate *outputs); @@ -1707,6 +1709,7 @@ int ntreeTexExecTree(struct bNodeTree *ntree, #define GEO_NODE_INPUT_MESH_ISLAND 1144 #define GEO_NODE_INPUT_SCENE_TIME 1145 #define GEO_NODE_ACCUMULATE_FIELD 1146 +#define GEO_NODE_INPUT_MESH_EDGE_ANGLE 1147 /** \} */ diff --git a/source/blender/blenkernel/intern/geometry_component_instances.cc b/source/blender/blenkernel/intern/geometry_component_instances.cc index a7e3c5b60dc..b411c793298 100644 --- a/source/blender/blenkernel/intern/geometry_component_instances.cc +++ b/source/blender/blenkernel/intern/geometry_component_instances.cc @@ -148,27 +148,27 @@ static void copy_data_based_on_mask(Span<T> src, MutableSpan<T> dst, IndexMask m }); } -void InstancesComponent::remove_instances(const IndexMask selection) +void InstancesComponent::remove_instances(const IndexMask mask) { using namespace blender; - if (selection.is_range() && selection.index_range().first() == 0) { + if (mask.is_range() && mask.as_range().start() == 0) { /* Deleting from the end of the array can be much faster since no data has to be shifted. */ - this->resize(selection.size()); + this->resize(mask.size()); this->remove_unused_references(); return; } - Vector<int> new_handles(selection.size()); - copy_data_based_on_mask<int>(this->instance_reference_handles(), new_handles, selection); + Vector<int> new_handles(mask.size()); + copy_data_based_on_mask<int>(this->instance_reference_handles(), new_handles, mask); instance_reference_handles_ = std::move(new_handles); - Vector<float4x4> new_transforms(selection.size()); - copy_data_based_on_mask<float4x4>(this->instance_transforms(), new_transforms, selection); + Vector<float4x4> new_transforms(mask.size()); + copy_data_based_on_mask<float4x4>(this->instance_transforms(), new_transforms, mask); instance_transforms_ = std::move(new_transforms); const bke::CustomDataAttributes &src_attributes = attributes_; bke::CustomDataAttributes dst_attributes; - dst_attributes.reallocate(selection.size()); + dst_attributes.reallocate(mask.size()); src_attributes.foreach_attribute( [&](const bke::AttributeIDRef &id, const AttributeMetaData &meta_data) { @@ -182,7 +182,7 @@ void InstancesComponent::remove_instances(const IndexMask selection) attribute_math::convert_to_static_type(src.type(), [&](auto dummy) { using T = decltype(dummy); - copy_data_based_on_mask<T>(src.typed<T>(), dst.typed<T>(), selection); + copy_data_based_on_mask<T>(src.typed<T>(), dst.typed<T>(), mask); }); return true; }, diff --git a/source/blender/blenkernel/intern/node.cc b/source/blender/blenkernel/intern/node.cc index e61afe02f57..f32db41f62d 100644 --- a/source/blender/blenkernel/intern/node.cc +++ b/source/blender/blenkernel/intern/node.cc @@ -4357,8 +4357,7 @@ static bool node_poll_instance_default(bNode *node, bNodeTree *ntree, const char return node->typeinfo->poll(node->typeinfo, ntree, disabled_hint); } -/* NOLINTNEXTLINE: readability-function-size */ -void node_type_base(bNodeType *ntype, int type, const char *name, short nclass, short flag) +void node_type_base(bNodeType *ntype, int type, const char *name, short nclass) { /* Use static type info header to map static int type to identifier string and RNA struct type. * Associate the RNA struct type with the bNodeType. @@ -4385,7 +4384,6 @@ void node_type_base(bNodeType *ntype, int type, const char *name, short nclass, ntype->type = type; BLI_strncpy(ntype->ui_name, name, sizeof(ntype->ui_name)); ntype->nclass = nclass; - ntype->flag = flag; node_type_base_defaults(ntype); @@ -4393,14 +4391,12 @@ void node_type_base(bNodeType *ntype, int type, const char *name, short nclass, ntype->poll_instance = node_poll_instance_default; } -void node_type_base_custom( - bNodeType *ntype, const char *idname, const char *name, short nclass, short flag) +void node_type_base_custom(bNodeType *ntype, const char *idname, const char *name, short nclass) { BLI_strncpy(ntype->idname, idname, sizeof(ntype->idname)); ntype->type = NODE_CUSTOM; BLI_strncpy(ntype->ui_name, name, sizeof(ntype->ui_name)); ntype->nclass = nclass; - ntype->flag = flag; node_type_base_defaults(ntype); } @@ -4576,7 +4572,7 @@ static void register_undefined_types() strcpy(NodeTreeTypeUndefined.ui_name, N_("Undefined")); strcpy(NodeTreeTypeUndefined.ui_description, N_("Undefined Node Tree Type")); - node_type_base_custom(&NodeTypeUndefined, "NodeUndefined", "Undefined", 0, 0); + node_type_base_custom(&NodeTypeUndefined, "NodeUndefined", "Undefined", 0); NodeTypeUndefined.poll = node_undefined_poll; BLI_strncpy(NodeSocketTypeUndefined.idname, @@ -4927,6 +4923,7 @@ static void registerGeometryNodes() register_node_type_geo_input_index(); register_node_type_geo_input_material_index(); register_node_type_geo_input_material(); + register_node_type_geo_input_mesh_edge_angle(); register_node_type_geo_input_mesh_edge_neighbors(); register_node_type_geo_input_mesh_edge_vertices(); register_node_type_geo_input_mesh_face_area(); diff --git a/source/blender/blenlib/BLI_span.hh b/source/blender/blenlib/BLI_span.hh index 5b7981e0302..995dc70a84d 100644 --- a/source/blender/blenlib/BLI_span.hh +++ b/source/blender/blenlib/BLI_span.hh @@ -599,6 +599,11 @@ template<typename T> class MutableSpan { return MutableSpan(data_ + start, new_size); } + constexpr MutableSpan slice(IndexRange range) const + { + return this->slice(range.start(), range.size()); + } + /** * Returns a new MutableSpan with n elements removed from the beginning. This invokes * undefined behavior when n is negative. diff --git a/source/blender/blenlib/intern/math_color_blend_inline.c b/source/blender/blenlib/intern/math_color_blend_inline.c index 53257cc9285..73ecb2cf798 100644 --- a/source/blender/blenlib/intern/math_color_blend_inline.c +++ b/source/blender/blenlib/intern/math_color_blend_inline.c @@ -382,7 +382,7 @@ MINLINE void blend_color_pinlight_byte(uchar dst[4], const uchar src1[4], const else { temp = min_ii(2 * src2[i], src1[i]); } - dst[i] = (uchar)((temp * fac + src1[i] * mfac) / 255); + dst[i] = (uchar)((min_ii(temp, 255) * fac + src1[i] * mfac) / 255); } } else { @@ -473,7 +473,7 @@ MINLINE void blend_color_exclusion_byte(uchar dst[4], const uchar src1[4], const int i = 3; while (i--) { - const int temp = 127 - ((2 * (src1[i] - 127) * (src2[i] - 127)) / 255); + const int temp = 127 - min_ii(((2 * (src1[i] - 127) * (src2[i] - 127)) / 255), 127); dst[i] = (uchar)((temp * fac + src1[i] * mfac) / 255); } } @@ -896,15 +896,9 @@ MINLINE void blend_color_softlight_float(float dst[4], const float src1[4], cons int i = 3; while (i--) { - float temp; - - if (src1[i] < 0.5f) { - temp = (src2[i] + 0.5f) * src1[i]; - } - else { - temp = 1.0f - ((1.0f - (src2[i] + 0.5f)) * (1.0f - src1[i])); - } - dst[i] = (temp * fac + src1[i] * mfac); + float screen = 1.0f - (1.0f - src1[i]) * (1.0f - src2[i]); + float soft_light = ((1.0f - src1[i]) * src2[i] + screen) * src1[i]; + dst[i] = src1[i] * mfac + soft_light * fac; } } else { diff --git a/source/blender/blenloader/CMakeLists.txt b/source/blender/blenloader/CMakeLists.txt index 05f74bfa834..245514d4977 100644 --- a/source/blender/blenloader/CMakeLists.txt +++ b/source/blender/blenloader/CMakeLists.txt @@ -26,6 +26,7 @@ set(INC ../blentranslation ../depsgraph ../draw + ../editors/include ../imbuf ../makesdna ../makesrna diff --git a/source/blender/blenloader/intern/versioning_300.c b/source/blender/blenloader/intern/versioning_300.c index 803e33aa8ad..035aa293b62 100644 --- a/source/blender/blenloader/intern/versioning_300.c +++ b/source/blender/blenloader/intern/versioning_300.c @@ -2509,5 +2509,22 @@ void blo_do_versions_300(FileData *fd, Library *UNUSED(lib), Main *bmain) } } FOREACH_NODETREE_END; + + /* Update spreadsheet data set region type. */ + LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) { + LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) { + LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) { + if (sl->spacetype == SPACE_SPREADSHEET) { + ListBase *regionbase = (sl == area->spacedata.first) ? &area->regionbase : + &sl->regionbase; + LISTBASE_FOREACH (ARegion *, region, regionbase) { + if (region->regiontype == RGN_TYPE_CHANNELS) { + region->regiontype = RGN_TYPE_TOOLS; + } + } + } + } + } + } } -} +}
\ No newline at end of file diff --git a/source/blender/blenloader/tests/blendfile_loading_base_test.cc b/source/blender/blenloader/tests/blendfile_loading_base_test.cc index 32d288f35e1..7a8afbcb227 100644 --- a/source/blender/blenloader/tests/blendfile_loading_base_test.cc +++ b/source/blender/blenloader/tests/blendfile_loading_base_test.cc @@ -27,9 +27,11 @@ #include "BKE_idtype.h" #include "BKE_image.h" #include "BKE_main.h" +#include "BKE_mball_tessellate.h" #include "BKE_modifier.h" #include "BKE_node.h" #include "BKE_scene.h" +#include "BKE_vfont.h" #include "BLI_path_util.h" #include "BLI_threads.h" @@ -44,6 +46,8 @@ #include "IMB_imbuf.h" +#include "ED_datafiles.h" + #include "RNA_define.h" #include "WM_api.h" @@ -73,6 +77,7 @@ void BlendfileLoadingBaseTest::SetUpTestCase() RNA_init(); BKE_node_system_init(); BKE_callback_global_init(); + BKE_vfont_builtin_register(datatoc_bfont_pfb, datatoc_bfont_pfb_size); G.background = true; G.factory_startup = true; @@ -111,6 +116,7 @@ void BlendfileLoadingBaseTest::TearDownTestCase() void BlendfileLoadingBaseTest::TearDown() { + BKE_mball_cubeTable_free(); depsgraph_free(); blendfile_free(); diff --git a/source/blender/compositor/operations/COM_CropOperation.cc b/source/blender/compositor/operations/COM_CropOperation.cc index 5d78ed9d41a..2385a0b54ba 100644 --- a/source/blender/compositor/operations/COM_CropOperation.cc +++ b/source/blender/compositor/operations/COM_CropOperation.cc @@ -42,22 +42,22 @@ void CropBaseOperation::update_area() local_settings.y1 = height * local_settings.fac_y1; local_settings.y2 = height * local_settings.fac_y2; } - if (width <= local_settings.x1 + 1) { - local_settings.x1 = width - 1; + if (width < local_settings.x1) { + local_settings.x1 = width; } - if (height <= local_settings.y1 + 1) { - local_settings.y1 = height - 1; + if (height < local_settings.y1) { + local_settings.y1 = height; } - if (width <= local_settings.x2 + 1) { - local_settings.x2 = width - 1; + if (width < local_settings.x2) { + local_settings.x2 = width; } - if (height <= local_settings.y2 + 1) { - local_settings.y2 = height - 1; + if (height < local_settings.y2) { + local_settings.y2 = height; } - xmax_ = MAX2(local_settings.x1, local_settings.x2) + 1; + xmax_ = MAX2(local_settings.x1, local_settings.x2); xmin_ = MIN2(local_settings.x1, local_settings.x2); - ymax_ = MAX2(local_settings.y1, local_settings.y2) + 1; + ymax_ = MAX2(local_settings.y1, local_settings.y2); ymin_ = MIN2(local_settings.y1, local_settings.y2); } else { @@ -98,10 +98,8 @@ void CropOperation::update_memory_buffer_partial(MemoryBuffer *output, const rcti &area, Span<MemoryBuffer *> inputs) { - rcti crop_area; - BLI_rcti_init(&crop_area, xmin_, xmax_, ymin_, ymax_); for (BuffersIterator<float> it = output->iterate_with(inputs, area); !it.is_end(); ++it) { - if (BLI_rcti_isect_pt(&crop_area, it.x, it.y)) { + if ((it.x < xmax_ && it.x >= xmin_) && (it.y < ymax_ && it.y >= ymin_)) { copy_v4_v4(it.out, it.in(0)); } else { @@ -166,11 +164,11 @@ void CropImageOperation::update_memory_buffer_partial(MemoryBuffer *output, const rcti &area, Span<MemoryBuffer *> inputs) { - rcti op_area; - BLI_rcti_init(&op_area, 0, get_width(), 0, get_height()); const MemoryBuffer *input = inputs[0]; + const int width = get_width(); + const int height = get_height(); for (BuffersIterator<float> it = output->iterate_with({}, area); !it.is_end(); ++it) { - if (BLI_rcti_isect_pt(&op_area, it.x, it.y)) { + if (it.x >= 0 && it.x < width && it.y >= 0 && it.y < height) { input->read_elem_checked(it.x + xmin_, it.y + ymin_, it.out); } else { diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc index f8562e16746..ecbe89b1e7f 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc @@ -199,9 +199,7 @@ IDNode *DepsgraphNodeBuilder::add_id_node(ID *id) nullptr, OperationCode::OPERATION, "", -1); /* Pin the node so that it and its relations are preserved by the unused nodes/relations * deletion. This is mainly to make it easier to debug visibility. */ - /* NOTE: Keep un-pinned for the 3.0 release. This way we are more sure that side effects of the - * change is minimal outside of the dependency graph area. */ - // visibility_operation->flag |= OperationFlag::DEPSOP_FLAG_PINNED; + visibility_operation->flag |= OperationFlag::DEPSOP_FLAG_PINNED; graph_->operations.append(visibility_operation); } return id_node; @@ -589,11 +587,7 @@ void DepsgraphNodeBuilder::build_id(ID *id) case ID_HA: case ID_PT: case ID_VO: - /* TODO(sergey): Get visibility from a "parent" somehow. - * - * NOTE: Similarly to above, we don't want false-positives on - * visibility. */ - build_object_data_geometry_datablock(id, false); + build_object_data_geometry_datablock(id); break; case ID_SPK: build_speaker((Speaker *)id); @@ -769,32 +763,28 @@ void DepsgraphNodeBuilder::build_object(int base_index, if (object->modifiers.first != nullptr) { BuilderWalkUserData data; data.builder = this; - data.is_parent_visible = is_visible; BKE_modifiers_foreach_ID_link(object, modifier_walk, &data); } /* Grease Pencil Modifiers. */ if (object->greasepencil_modifiers.first != nullptr) { BuilderWalkUserData data; data.builder = this; - data.is_parent_visible = is_visible; BKE_gpencil_modifiers_foreach_ID_link(object, modifier_walk, &data); } /* Shader FX. */ if (object->shader_fx.first != nullptr) { BuilderWalkUserData data; data.builder = this; - data.is_parent_visible = is_visible; BKE_shaderfx_foreach_ID_link(object, modifier_walk, &data); } /* Constraints. */ if (object->constraints.first != nullptr) { BuilderWalkUserData data; data.builder = this; - data.is_parent_visible = is_visible; BKE_constraints_id_loop(&object->constraints, constraint_walk, &data); } /* Object data. */ - build_object_data(object, is_visible); + build_object_data(object); /* Parameters, used by both drivers/animation and also to inform dependency * from object's data. */ build_parameters(&object->id); @@ -897,7 +887,7 @@ void DepsgraphNodeBuilder::build_object_instance_collection(Object *object, bool is_parent_collection_visible_ = is_current_parent_collection_visible; } -void DepsgraphNodeBuilder::build_object_data(Object *object, bool is_object_visible) +void DepsgraphNodeBuilder::build_object_data(Object *object) { if (object->data == nullptr) { return; @@ -914,14 +904,14 @@ void DepsgraphNodeBuilder::build_object_data(Object *object, bool is_object_visi case OB_HAIR: case OB_POINTCLOUD: case OB_VOLUME: - build_object_data_geometry(object, is_object_visible); + build_object_data_geometry(object); break; case OB_ARMATURE: if (ID_IS_LINKED(object) && object->proxy_from != nullptr) { - build_proxy_rig(object, is_object_visible); + build_proxy_rig(object); } else { - build_rig(object, is_object_visible); + build_rig(object); } break; case OB_LAMP: @@ -1472,7 +1462,7 @@ void DepsgraphNodeBuilder::build_shapekeys(Key *key) /* ObData Geometry Evaluation */ /* XXX: what happens if the datablock is shared! */ -void DepsgraphNodeBuilder::build_object_data_geometry(Object *object, bool is_object_visible) +void DepsgraphNodeBuilder::build_object_data_geometry(Object *object) { OperationNode *op_node; Scene *scene_cow = get_cow_datablock(scene_); @@ -1494,7 +1484,7 @@ void DepsgraphNodeBuilder::build_object_data_geometry(Object *object, bool is_ob /* Point caches. */ build_object_pointcache(object); /* Geometry. */ - build_object_data_geometry_datablock((ID *)object->data, is_object_visible); + build_object_data_geometry_datablock((ID *)object->data); build_dimensions(object); /* Batch cache. */ add_operation_node( @@ -1504,7 +1494,7 @@ void DepsgraphNodeBuilder::build_object_data_geometry(Object *object, bool is_ob [object_cow](::Depsgraph *depsgraph) { BKE_object_select_update(depsgraph, object_cow); }); } -void DepsgraphNodeBuilder::build_object_data_geometry_datablock(ID *obdata, bool is_object_visible) +void DepsgraphNodeBuilder::build_object_data_geometry_datablock(ID *obdata) { if (built_map_.checkIsBuiltAndTag(obdata)) { return; @@ -1548,17 +1538,15 @@ void DepsgraphNodeBuilder::build_object_data_geometry_datablock(ID *obdata, bool BKE_curve_eval_geometry(depsgraph, (Curve *)obdata_cow); }); op_node->set_as_entry(); - /* Make sure objects used for bevel.taper are in the graph. - * NOTE: This objects might be not linked to the scene. */ Curve *cu = (Curve *)obdata; if (cu->bevobj != nullptr) { - build_object(-1, cu->bevobj, DEG_ID_LINKED_INDIRECTLY, is_object_visible); + build_object(-1, cu->bevobj, DEG_ID_LINKED_INDIRECTLY, false); } if (cu->taperobj != nullptr) { - build_object(-1, cu->taperobj, DEG_ID_LINKED_INDIRECTLY, is_object_visible); + build_object(-1, cu->taperobj, DEG_ID_LINKED_INDIRECTLY, false); } if (cu->textoncurve != nullptr) { - build_object(-1, cu->textoncurve, DEG_ID_LINKED_INDIRECTLY, is_object_visible); + build_object(-1, cu->textoncurve, DEG_ID_LINKED_INDIRECTLY, false); } break; } @@ -2121,10 +2109,7 @@ void DepsgraphNodeBuilder::modifier_walk(void *user_data, } switch (GS(id->name)) { case ID_OB: - /* Special case for object, so we take owner visibility into - * account. */ - data->builder->build_object( - -1, (Object *)id, DEG_ID_LINKED_INDIRECTLY, data->is_parent_visible); + data->builder->build_object(-1, (Object *)id, DEG_ID_LINKED_INDIRECTLY, false); break; default: data->builder->build_id(id); @@ -2144,10 +2129,7 @@ void DepsgraphNodeBuilder::constraint_walk(bConstraint * /*con*/, } switch (GS(id->name)) { case ID_OB: - /* Special case for object, so we take owner visibility into - * account. */ - data->builder->build_object( - -1, (Object *)id, DEG_ID_LINKED_INDIRECTLY, data->is_parent_visible); + data->builder->build_object(-1, (Object *)id, DEG_ID_LINKED_INDIRECTLY, false); break; default: data->builder->build_id(id); diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.h b/source/blender/depsgraph/intern/builder/deg_builder_nodes.h index 2d24dc49802..83bc33b6a4e 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.h +++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.h @@ -186,20 +186,17 @@ class DepsgraphNodeBuilder : public DepsgraphBuilder { virtual void build_object_flags(int base_index, Object *object, eDepsNode_LinkedState_Type linked_state); - virtual void build_object_data(Object *object, bool is_object_visible); + virtual void build_object_data(Object *object); virtual void build_object_data_camera(Object *object); - virtual void build_object_data_geometry(Object *object, bool is_object_visible); - virtual void build_object_data_geometry_datablock(ID *obdata, bool is_object_visible); + virtual void build_object_data_geometry(Object *object); + virtual void build_object_data_geometry_datablock(ID *obdata); virtual void build_object_data_light(Object *object); virtual void build_object_data_lightprobe(Object *object); virtual void build_object_data_speaker(Object *object); virtual void build_object_transform(Object *object); virtual void build_object_constraints(Object *object); virtual void build_object_pointcache(Object *object); - virtual void build_pose_constraints(Object *object, - bPoseChannel *pchan, - int pchan_index, - bool is_object_visible); + virtual void build_pose_constraints(Object *object, bPoseChannel *pchan, int pchan_index); virtual void build_rigidbody(Scene *scene); virtual void build_particle_systems(Object *object, bool is_object_visible); virtual void build_particle_settings(ParticleSettings *part); @@ -227,8 +224,8 @@ class DepsgraphNodeBuilder : public DepsgraphBuilder { virtual void build_dimensions(Object *object); virtual void build_ik_pose(Object *object, bPoseChannel *pchan, bConstraint *con); virtual void build_splineik_pose(Object *object, bPoseChannel *pchan, bConstraint *con); - virtual void build_rig(Object *object, bool is_object_visible); - virtual void build_proxy_rig(Object *object, bool is_object_visible); + virtual void build_rig(Object *object); + virtual void build_proxy_rig(Object *object); virtual void build_armature(bArmature *armature); virtual void build_armature_bones(ListBase *bones); virtual void build_shapekeys(Key *key); @@ -284,8 +281,6 @@ class DepsgraphNodeBuilder : public DepsgraphBuilder { struct BuilderWalkUserData { DepsgraphNodeBuilder *builder; - /* Denotes whether object the walk is invoked from is visible. */ - bool is_parent_visible; }; static void modifier_walk(void *user_data, struct Object *object, diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes_rig.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes_rig.cc index 00c78b8edce..e8dda7b8de4 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_nodes_rig.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes_rig.cc @@ -58,13 +58,11 @@ namespace blender::deg { void DepsgraphNodeBuilder::build_pose_constraints(Object *object, bPoseChannel *pchan, - int pchan_index, - bool is_object_visible) + int pchan_index) { /* Pull indirect dependencies via constraints. */ BuilderWalkUserData data; data.builder = this; - data.is_parent_visible = is_object_visible; BKE_constraints_id_loop(&pchan->constraints, constraint_walk, &data); /* Create node for constraint stack. */ @@ -147,7 +145,7 @@ void DepsgraphNodeBuilder::build_splineik_pose(Object *object, } /* Pose/Armature Bones Graph */ -void DepsgraphNodeBuilder::build_rig(Object *object, bool is_object_visible) +void DepsgraphNodeBuilder::build_rig(Object *object) { bArmature *armature = (bArmature *)object->data; Scene *scene_cow = get_cow_datablock(scene_); @@ -272,7 +270,7 @@ void DepsgraphNodeBuilder::build_rig(Object *object, bool is_object_visible) } /* Build constraints. */ if (pchan->constraints.first != nullptr) { - build_pose_constraints(object, pchan, pchan_index, is_object_visible); + build_pose_constraints(object, pchan, pchan_index); } /** * IK Solvers. @@ -301,14 +299,14 @@ void DepsgraphNodeBuilder::build_rig(Object *object, bool is_object_visible) } /* Custom shape. */ if (pchan->custom != nullptr) { - /* TODO(sergey): Use own visibility. */ - build_object(-1, pchan->custom, DEG_ID_LINKED_INDIRECTLY, is_object_visible); + /* NOTE: The relation builder will ensure visibility of the custom shape object. */ + build_object(-1, pchan->custom, DEG_ID_LINKED_INDIRECTLY, false); } pchan_index++; } } -void DepsgraphNodeBuilder::build_proxy_rig(Object *object, bool is_object_visible) +void DepsgraphNodeBuilder::build_proxy_rig(Object *object) { bArmature *armature = (bArmature *)object->data; OperationNode *op_node; @@ -356,7 +354,8 @@ void DepsgraphNodeBuilder::build_proxy_rig(Object *object, bool is_object_visibl /* Custom shape. */ if (pchan->custom != nullptr) { - build_object(-1, pchan->custom, DEG_ID_LINKED_INDIRECTLY, is_object_visible); + /* NOTE: The relation builder will ensure visibility of the custom shape object. */ + build_object(-1, pchan->custom, DEG_ID_LINKED_INDIRECTLY, false); } pchan_index++; diff --git a/source/blender/depsgraph/intern/node/deg_node.h b/source/blender/depsgraph/intern/node/deg_node.h index ef58a35afb2..6cb5e31303f 100644 --- a/source/blender/depsgraph/intern/node/deg_node.h +++ b/source/blender/depsgraph/intern/node/deg_node.h @@ -112,11 +112,11 @@ enum class NodeType { * which simplifies common algorithms which are dealing with relations and visibility. * * The fact that the visibility operates on the ID level basically means that all components in - * NodeA will be considered as affecting directly visible when NodeB's visibility is + * the NodeA will be considered as affecting directly visible when NodeB's visibility is * affecting directly visible ID. * * This is the way to ensure objects needed for visualization without any actual data dependency - * are properly evaluated. Example of this is custom shapes for bones. */ + * properly evaluated. Example of this is custom shapes for bones. */ VISIBILITY, /* **** Evaluation-Related Outer Types (with Subdata) **** */ diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h index 5fd176813e6..cee323bd5c9 100644 --- a/source/blender/editors/include/UI_interface.h +++ b/source/blender/editors/include/UI_interface.h @@ -2044,6 +2044,7 @@ uiLayout *UI_block_layout(uiBlock *block, const struct uiStyle *style); void UI_block_layout_set_current(uiBlock *block, uiLayout *layout); void UI_block_layout_resolve(uiBlock *block, int *r_x, int *r_y); +bool UI_block_layout_needs_resolving(const uiBlock *block); /** * Used for property search when the layout process needs to be cancelled in order to avoid * computing the locations for buttons, but the layout items created while adding the buttons diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index d720b52a59e..659ac0ae899 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -3495,8 +3495,17 @@ static void ui_textedit_begin(bContext *C, uiBut *but, uiHandleButtonData *data) ui_but_update(but); - /* Popup blocks don't support moving after creation, so don't change the view for them. */ - if (!data->searchbox) { + /* Make sure the edited button is in view. */ + if (data->searchbox) { + /* Popup blocks don't support moving after creation, so don't change the view for them. */ + } + else if (UI_block_layout_needs_resolving(but->block)) { + /* Layout isn't resolved yet (may happen when activating while drawing through + * #UI_but_active_only()), so can't move it into view yet. This causes + * #ui_but_update_view_for_active() to run after the layout is resolved. */ + but->changed = true; + } + else { UI_but_ensure_in_view(C, data->region, but); } diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index cbdb284c66b..98fcb36b778 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -5661,6 +5661,11 @@ void UI_block_layout_resolve(uiBlock *block, int *r_x, int *r_y) } } +bool UI_block_layout_needs_resolving(const uiBlock *block) +{ + return !BLI_listbase_is_empty(&block->layouts); +} + void uiLayoutSetContextPointer(uiLayout *layout, const char *name, PointerRNA *ptr) { uiBlock *block = layout->root->block; diff --git a/source/blender/editors/io/CMakeLists.txt b/source/blender/editors/io/CMakeLists.txt index 44b5f85050f..f4da114159f 100644 --- a/source/blender/editors/io/CMakeLists.txt +++ b/source/blender/editors/io/CMakeLists.txt @@ -25,6 +25,20 @@ set(INC ../../io/alembic ../../io/collada ../../io/gpencil + ../../io/wavefront_obj + ../../io/usd + ../../makesdna + ../../makesrna + ../../windowmanager + ../../../../intern/guardedalloc +) + +set(INC_SYS + +) + +set(SRC + io_alembic.c ../../io/usd ../../makesdna ../../makesrna @@ -43,6 +57,7 @@ set(SRC io_gpencil_export.c io_gpencil_import.c io_gpencil_utils.c + io_obj.c io_ops.c io_usd.c @@ -57,6 +72,7 @@ set(SRC set(LIB bf_blenkernel bf_blenlib + bf_wavefront_obj ) if(WITH_OPENCOLLADA) diff --git a/source/blender/editors/io/io_obj.c b/source/blender/editors/io/io_obj.c new file mode 100644 index 00000000000..1e1e3c2ff42 --- /dev/null +++ b/source/blender/editors/io/io_obj.c @@ -0,0 +1,369 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/** \file + * \ingroup editor/io + */ + +#include "DNA_space_types.h" + +#include "BKE_context.h" +#include "BKE_main.h" +#include "BKE_report.h" + +#include "BLI_path_util.h" +#include "BLI_string.h" +#include "BLI_utildefines.h" + +#include "BLT_translation.h" + +#include "MEM_guardedalloc.h" + +#include "RNA_access.h" +#include "RNA_define.h" + +#include "UI_interface.h" +#include "UI_resources.h" + +#include "WM_api.h" +#include "WM_types.h" + +#include "DEG_depsgraph.h" + +#include "IO_wavefront_obj.h" +#include "io_obj.h" + +const EnumPropertyItem io_obj_transform_axis_forward[] = { + {OBJ_AXIS_X_FORWARD, "X_FORWARD", 0, "X", "Positive X axis"}, + {OBJ_AXIS_Y_FORWARD, "Y_FORWARD", 0, "Y", "Positive Y axis"}, + {OBJ_AXIS_Z_FORWARD, "Z_FORWARD", 0, "Z", "Positive Z axis"}, + {OBJ_AXIS_NEGATIVE_X_FORWARD, "NEGATIVE_X_FORWARD", 0, "-X", "Negative X axis"}, + {OBJ_AXIS_NEGATIVE_Y_FORWARD, "NEGATIVE_Y_FORWARD", 0, "-Y", "Negative Y axis"}, + {OBJ_AXIS_NEGATIVE_Z_FORWARD, "NEGATIVE_Z_FORWARD", 0, "-Z (Default)", "Negative Z axis"}, + {0, NULL, 0, NULL, NULL}}; + +const EnumPropertyItem io_obj_transform_axis_up[] = { + {OBJ_AXIS_X_UP, "X_UP", 0, "X", "Positive X axis"}, + {OBJ_AXIS_Y_UP, "Y_UP", 0, "Y (Default)", "Positive Y axis"}, + {OBJ_AXIS_Z_UP, "Z_UP", 0, "Z", "Positive Z axis"}, + {OBJ_AXIS_NEGATIVE_X_UP, "NEGATIVE_X_UP", 0, "-X", "Negative X axis"}, + {OBJ_AXIS_NEGATIVE_Y_UP, "NEGATIVE_Y_UP", 0, "-Y", "Negative Y axis"}, + {OBJ_AXIS_NEGATIVE_Z_UP, "NEGATIVE_Z_UP", 0, "-Z", "Negative Z axis"}, + {0, NULL, 0, NULL, NULL}}; + +const EnumPropertyItem io_obj_export_evaluation_mode[] = { + {DAG_EVAL_RENDER, "DAG_EVAL_RENDER", 0, "Render", "Export objects as they appear in render"}, + {DAG_EVAL_VIEWPORT, + "DAG_EVAL_VIEWPORT", + 0, + "Viewport (Default)", + "Export objects as they appear in the viewport"}, + {0, NULL, 0, NULL, NULL}}; + +static int wm_obj_export_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event)) +{ + if (!RNA_struct_property_is_set(op->ptr, "filepath")) { + Main *bmain = CTX_data_main(C); + char filepath[FILE_MAX]; + + if (BKE_main_blendfile_path(bmain)[0] == '\0') { + BLI_strncpy(filepath, "untitled", sizeof(filepath)); + } + else { + BLI_strncpy(filepath, BKE_main_blendfile_path(bmain), sizeof(filepath)); + } + + BLI_path_extension_replace(filepath, sizeof(filepath), ".obj"); + RNA_string_set(op->ptr, "filepath", filepath); + } + + WM_event_add_fileselect(C, op); + return OPERATOR_RUNNING_MODAL; +} + +static int wm_obj_export_exec(bContext *C, wmOperator *op) +{ + if (!RNA_struct_property_is_set(op->ptr, "filepath")) { + BKE_report(op->reports, RPT_ERROR, "No filename given"); + return OPERATOR_CANCELLED; + } + struct OBJExportParams export_params; + RNA_string_get(op->ptr, "filepath", export_params.filepath); + export_params.blen_filepath = CTX_data_main(C)->filepath; + export_params.export_animation = RNA_boolean_get(op->ptr, "export_animation"); + export_params.start_frame = RNA_int_get(op->ptr, "start_frame"); + export_params.end_frame = RNA_int_get(op->ptr, "end_frame"); + + export_params.forward_axis = RNA_enum_get(op->ptr, "forward_axis"); + export_params.up_axis = RNA_enum_get(op->ptr, "up_axis"); + export_params.scaling_factor = RNA_float_get(op->ptr, "scaling_factor"); + export_params.export_eval_mode = RNA_enum_get(op->ptr, "export_eval_mode"); + + export_params.export_selected_objects = RNA_boolean_get(op->ptr, "export_selected_objects"); + export_params.export_uv = RNA_boolean_get(op->ptr, "export_uv"); + export_params.export_normals = RNA_boolean_get(op->ptr, "export_normals"); + export_params.export_materials = RNA_boolean_get(op->ptr, "export_materials"); + export_params.export_triangulated_mesh = RNA_boolean_get(op->ptr, "export_triangulated_mesh"); + export_params.export_curves_as_nurbs = RNA_boolean_get(op->ptr, "export_curves_as_nurbs"); + + export_params.export_object_groups = RNA_boolean_get(op->ptr, "export_object_groups"); + export_params.export_material_groups = RNA_boolean_get(op->ptr, "export_material_groups"); + export_params.export_vertex_groups = RNA_boolean_get(op->ptr, "export_vertex_groups"); + export_params.export_smooth_groups = RNA_boolean_get(op->ptr, "export_smooth_groups"); + export_params.smooth_groups_bitflags = RNA_boolean_get(op->ptr, "smooth_group_bitflags"); + + OBJ_export(C, &export_params); + + return OPERATOR_FINISHED; +} + +static void ui_obj_export_settings(uiLayout *layout, PointerRNA *imfptr) +{ + + const bool export_animation = RNA_boolean_get(imfptr, "export_animation"); + const bool export_smooth_groups = RNA_boolean_get(imfptr, "export_smooth_groups"); + + uiLayoutSetPropSep(layout, true); + uiLayoutSetPropDecorate(layout, false); + + /* Animation options. */ + uiLayout *box = uiLayoutBox(layout); + uiItemL(box, IFACE_("Animation"), ICON_ANIM); + uiLayout *col = uiLayoutColumn(box, false); + uiLayout *sub = uiLayoutColumn(col, false); + uiItemR(sub, imfptr, "export_animation", 0, NULL, ICON_NONE); + sub = uiLayoutColumn(sub, true); + uiItemR(sub, imfptr, "start_frame", 0, IFACE_("Frame Start"), ICON_NONE); + uiItemR(sub, imfptr, "end_frame", 0, IFACE_("End"), ICON_NONE); + uiLayoutSetEnabled(sub, export_animation); + + /* Object Transform options. */ + box = uiLayoutBox(layout); + uiItemL(box, IFACE_("Object Properties"), ICON_OBJECT_DATA); + col = uiLayoutColumn(box, false); + sub = uiLayoutColumn(col, false); + uiItemR(sub, imfptr, "forward_axis", 0, IFACE_("Axis Forward"), ICON_NONE); + uiItemR(sub, imfptr, "up_axis", 0, IFACE_("Up"), ICON_NONE); + sub = uiLayoutColumn(col, false); + uiItemR(sub, imfptr, "scaling_factor", 0, NULL, ICON_NONE); + sub = uiLayoutColumnWithHeading(col, false, IFACE_("Objects")); + uiItemR(sub, imfptr, "export_selected_objects", 0, IFACE_("Selected Only"), ICON_NONE); + uiItemR(sub, imfptr, "export_eval_mode", 0, IFACE_("Properties"), ICON_NONE); + + /* Options for what to write. */ + box = uiLayoutBox(layout); + uiItemL(box, IFACE_("Geometry Export"), ICON_EXPORT); + col = uiLayoutColumn(box, false); + sub = uiLayoutColumnWithHeading(col, false, IFACE_("Export")); + uiItemR(sub, imfptr, "export_uv", 0, IFACE_("UV Coordinates"), ICON_NONE); + uiItemR(sub, imfptr, "export_normals", 0, IFACE_("Normals"), ICON_NONE); + uiItemR(sub, imfptr, "export_materials", 0, IFACE_("Materials"), ICON_NONE); + uiItemR(sub, imfptr, "export_triangulated_mesh", 0, IFACE_("Triangulated Mesh"), ICON_NONE); + uiItemR(sub, imfptr, "export_curves_as_nurbs", 0, IFACE_("Curves as NURBS"), ICON_NONE); + + box = uiLayoutBox(layout); + uiItemL(box, IFACE_("Grouping"), ICON_GROUP); + col = uiLayoutColumn(box, false); + sub = uiLayoutColumnWithHeading(col, false, IFACE_("Export")); + uiItemR(sub, imfptr, "export_object_groups", 0, IFACE_("Object Groups"), ICON_NONE); + uiItemR(sub, imfptr, "export_material_groups", 0, IFACE_("Material Groups"), ICON_NONE); + uiItemR(sub, imfptr, "export_vertex_groups", 0, IFACE_("Vertex Groups"), ICON_NONE); + uiItemR(sub, imfptr, "export_smooth_groups", 0, IFACE_("Smooth Groups"), ICON_NONE); + sub = uiLayoutColumn(sub, false); + uiLayoutSetEnabled(sub, export_smooth_groups); + uiItemR(sub, imfptr, "smooth_group_bitflags", 0, IFACE_("Smooth Group Bitflags"), ICON_NONE); +} + +static void wm_obj_export_draw(bContext *UNUSED(C), wmOperator *op) +{ + PointerRNA ptr; + RNA_pointer_create(NULL, op->type->srna, op->properties, &ptr); + ui_obj_export_settings(op->layout, &ptr); +} + +/** + * Return true if any property in the UI is changed. + */ +static bool wm_obj_export_check(bContext *C, wmOperator *op) +{ + char filepath[FILE_MAX]; + Scene *scene = CTX_data_scene(C); + bool changed = false; + RNA_string_get(op->ptr, "filepath", filepath); + + if (!BLI_path_extension_check(filepath, ".obj")) { + BLI_path_extension_ensure(filepath, FILE_MAX, ".obj"); + RNA_string_set(op->ptr, "filepath", filepath); + changed = true; + } + + { + int start = RNA_int_get(op->ptr, "start_frame"); + int end = RNA_int_get(op->ptr, "end_frame"); + /* Set the defaults. */ + if (start == INT_MIN) { + start = SFRA; + changed = true; + } + if (end == INT_MAX) { + end = EFRA; + changed = true; + } + /* Fix user errors. */ + if (end < start) { + end = start; + changed = true; + } + RNA_int_set(op->ptr, "start_frame", start); + RNA_int_set(op->ptr, "end_frame", end); + } + + /* Both forward and up axes cannot be the same (or same except opposite sign). */ + if (RNA_enum_get(op->ptr, "forward_axis") % TOTAL_AXES == + (RNA_enum_get(op->ptr, "up_axis") % TOTAL_AXES)) { + /* TODO (ankitm) Show a warning here. */ + RNA_enum_set(op->ptr, "up_axis", RNA_enum_get(op->ptr, "up_axis") % TOTAL_AXES + 1); + changed = true; + } + return changed; +} + +void WM_OT_obj_export(struct wmOperatorType *ot) +{ + ot->name = "Export Wavefront OBJ"; + ot->description = "Save the scene to a Wavefront OBJ file"; + ot->idname = "WM_OT_obj_export"; + + ot->invoke = wm_obj_export_invoke; + ot->exec = wm_obj_export_exec; + ot->poll = WM_operator_winactive; + ot->ui = wm_obj_export_draw; + ot->check = wm_obj_export_check; + + WM_operator_properties_filesel(ot, + FILE_TYPE_FOLDER | FILE_TYPE_OBJECT_IO, + FILE_BLENDER, + FILE_SAVE, + WM_FILESEL_FILEPATH | WM_FILESEL_SHOW_PROPS, + FILE_DEFAULTDISPLAY, + FILE_SORT_ALPHA); + + /* Animation options. */ + RNA_def_boolean(ot->srna, + "export_animation", + false, + "Export Animation", + "Export multiple frames instead of the current frame only"); + RNA_def_int(ot->srna, + "start_frame", + INT_MIN, /* wm_obj_export_check uses this to set SFRA. */ + INT_MIN, + INT_MAX, + "Start Frame", + "The first frame to be exported", + INT_MIN, + INT_MAX); + RNA_def_int(ot->srna, + "end_frame", + INT_MAX, /* wm_obj_export_check uses this to set EFRA. */ + INT_MIN, + INT_MAX, + "End Frame", + "The last frame to be exported", + INT_MIN, + INT_MAX); + /* Object transform options. */ + RNA_def_enum(ot->srna, + "forward_axis", + io_obj_transform_axis_forward, + OBJ_AXIS_NEGATIVE_Z_FORWARD, + "Forward Axis", + ""); + RNA_def_enum(ot->srna, "up_axis", io_obj_transform_axis_up, OBJ_AXIS_Y_UP, "Up Axis", ""); + RNA_def_float(ot->srna, + "scaling_factor", + 1.0f, + 0.001f, + 10000.0f, + "Scale", + "Upscale the object by this factor", + 0.01, + 1000.0f); + /* File Writer options. */ + RNA_def_enum(ot->srna, + "export_eval_mode", + io_obj_export_evaluation_mode, + DAG_EVAL_VIEWPORT, + "Object Properties", + "Determines properties like object visibility, modifiers etc., where they differ " + "for Render and Viewport"); + RNA_def_boolean(ot->srna, + "export_selected_objects", + false, + "Export Selected Objects", + "Export only selected objects instead of all supported objects"); + RNA_def_boolean(ot->srna, "export_uv", true, "Export UVs", ""); + RNA_def_boolean(ot->srna, + "export_normals", + true, + "Export Normals", + "Export per-face normals if the face is flat-shaded, per-face-per-loop " + "normals if smooth-shaded"); + RNA_def_boolean(ot->srna, + "export_materials", + true, + "Export Materials", + "Export MTL library. There must be a Principled-BSDF node for image textures to " + "be exported to the MTL file"); + RNA_def_boolean(ot->srna, + "export_triangulated_mesh", + false, + "Export Triangulated Mesh", + "All ngons with four or more vertices will be triangulated. Meshes in " + "the scene will not be affected. Behaves like Triangulate Modifier with " + "ngon-method: \"Beauty\", quad-method: \"Shortest Diagonal\", min vertices: 4"); + RNA_def_boolean(ot->srna, + "export_curves_as_nurbs", + false, + "Export Curves as NURBS", + "Export curves in parametric form instead of exporting as mesh"); + + RNA_def_boolean(ot->srna, + "export_object_groups", + false, + "Export Object Groups", + "Append mesh name to object name, separated by a '_'"); + RNA_def_boolean(ot->srna, + "export_material_groups", + false, + "Export Material Groups", + "Append mesh name and material name to object name, separated by a '_'"); + RNA_def_boolean( + ot->srna, + "export_vertex_groups", + false, + "Export Vertex Groups", + "Export the name of the vertex group of a face. It is approximated " + "by choosing the vertex group with the most members among the vertices of a face"); + RNA_def_boolean( + ot->srna, + "export_smooth_groups", + false, + "Export Smooth Groups", + "Every smooth-shaded face is assigned group \"1\" and every flat-shaded face \"off\""); + RNA_def_boolean( + ot->srna, "smooth_group_bitflags", false, "Generate Bitflags for Smooth Groups", ""); +} diff --git a/source/blender/editors/io/io_obj.h b/source/blender/editors/io/io_obj.h new file mode 100644 index 00000000000..5a0e6971edd --- /dev/null +++ b/source/blender/editors/io/io_obj.h @@ -0,0 +1,25 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/** \file + * \ingroup editor/io + */ + +#pragma once + +struct wmOperatorType; + +void WM_OT_obj_export(struct wmOperatorType *ot); diff --git a/source/blender/editors/io/io_ops.c b/source/blender/editors/io/io_ops.c index b2788ee49a2..5dff0b69c2a 100644 --- a/source/blender/editors/io/io_ops.c +++ b/source/blender/editors/io/io_ops.c @@ -39,6 +39,7 @@ #include "io_cache.h" #include "io_gpencil.h" +#include "io_obj.h" void ED_operatortypes_io(void) { @@ -68,4 +69,5 @@ void ED_operatortypes_io(void) WM_operatortype_append(CACHEFILE_OT_open); WM_operatortype_append(CACHEFILE_OT_reload); + WM_operatortype_append(WM_OT_obj_export); } diff --git a/source/blender/editors/space_clip/space_clip.c b/source/blender/editors/space_clip/space_clip.c index 91083fa9682..847cba32c69 100644 --- a/source/blender/editors/space_clip/space_clip.c +++ b/source/blender/editors/space_clip/space_clip.c @@ -1079,6 +1079,9 @@ static void graph_region_draw(const bContext *C, ARegion *region) /* time-scrubbing */ ED_time_scrub_draw(region, scene, sc->flag & SC_SHOW_SECONDS, true); + /* current frame indicator */ + ED_time_scrub_draw_current_frame(region, scene, sc->flag & SC_SHOW_SECONDS); + /* scrollers */ UI_view2d_scrollers_draw(v2d, NULL); @@ -1126,6 +1129,9 @@ static void dopesheet_region_draw(const bContext *C, ARegion *region) /* time-scrubbing */ ED_time_scrub_draw(region, scene, sc->flag & SC_SHOW_SECONDS, true); + /* current frame indicator */ + ED_time_scrub_draw_current_frame(region, scene, sc->flag & SC_SHOW_SECONDS); + /* scrollers */ UI_view2d_scrollers_draw(v2d, NULL); } diff --git a/source/blender/editors/space_file/filesel.c b/source/blender/editors/space_file/filesel.c index 03261d6f267..f9783d1b19f 100644 --- a/source/blender/editors/space_file/filesel.c +++ b/source/blender/editors/space_file/filesel.c @@ -275,6 +275,9 @@ static FileSelectParams *fileselect_ensure_updated_file_params(SpaceFile *sfile) if ((prop = RNA_struct_find_property(op->ptr, "filter_usd"))) { params->filter |= RNA_property_boolean_get(op->ptr, prop) ? FILE_TYPE_USD : 0; } + if ((prop = RNA_struct_find_property(op->ptr, "filter_obj"))) { + params->filter |= RNA_property_boolean_get(op->ptr, prop) ? FILE_TYPE_OBJECT_IO : 0; + } if ((prop = RNA_struct_find_property(op->ptr, "filter_volume"))) { params->filter |= RNA_property_boolean_get(op->ptr, prop) ? FILE_TYPE_VOLUME : 0; } diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index b72fe40d510..23d07c9b45b 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -2595,6 +2595,11 @@ static int image_new_exec(bContext *C, wmOperator *op) else if (sima) { ED_space_image_set(bmain, sima, ima, false); } + else { + /* #BKE_image_add_generated creates one user by default, remove it if image is not linked to + * anything. ref. T94599. */ + id_us_min(&ima->id); + } BKE_image_signal(bmain, ima, (sima) ? &sima->iuser : NULL, IMA_SIGNAL_USER_NEW_IMAGE); diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c index 2d78b79b9a2..40be8e6e641 100644 --- a/source/blender/editors/transform/transform_snap.c +++ b/source/blender/editors/transform/transform_snap.c @@ -693,6 +693,15 @@ static void initSnappingMode(TransInfo *t) bm_face_is_snap_target, POINTER_FROM_UINT((BM_ELEM_SELECT | BM_ELEM_HIDDEN))); } + else { + /* Ignore hidden geometry in the general case. */ + ED_transform_snap_object_context_set_editmesh_callbacks( + t->tsnap.object_context, + (bool (*)(BMVert *, void *))BM_elem_cb_check_hflag_disabled, + (bool (*)(BMEdge *, void *))BM_elem_cb_check_hflag_disabled, + (bool (*)(BMFace *, void *))BM_elem_cb_check_hflag_disabled, + POINTER_FROM_UINT(BM_ELEM_HIDDEN)); + } } } else if (t->spacetype == SPACE_SEQ) { diff --git a/source/blender/functions/FN_field.hh b/source/blender/functions/FN_field.hh index b8cb05fecab..11f8a7e9b94 100644 --- a/source/blender/functions/FN_field.hh +++ b/source/blender/functions/FN_field.hh @@ -287,7 +287,7 @@ class FieldConstant : public FieldNode { const CPPType &output_cpp_type(int output_index) const override; const CPPType &type() const; - const GPointer value() const; + GPointer value() const; }; /** diff --git a/source/blender/functions/intern/field.cc b/source/blender/functions/intern/field.cc index 6a4d46c14f2..d6b83c42294 100644 --- a/source/blender/functions/intern/field.cc +++ b/source/blender/functions/intern/field.cc @@ -684,7 +684,7 @@ const CPPType &FieldConstant::type() const return type_; } -const GPointer FieldConstant::value() const +GPointer FieldConstant::value() const { return {type_, value_}; } diff --git a/source/blender/gpu/opengl/gl_shader.cc b/source/blender/gpu/opengl/gl_shader.cc index cd2c3caad46..8367b0de02b 100644 --- a/source/blender/gpu/opengl/gl_shader.cc +++ b/source/blender/gpu/opengl/gl_shader.cc @@ -47,7 +47,7 @@ GLShader::GLShader(const char *name) : Shader(name) { #if 0 /* Would be nice to have, but for now the Deferred compilation \ * does not have a GPUContext. */ - BLI_assert(GLContext::get() != NULL); + BLI_assert(GLContext::get() != nullptr); #endif shader_program_ = glCreateProgram(); @@ -58,7 +58,7 @@ GLShader::~GLShader() { #if 0 /* Would be nice to have, but for now the Deferred compilation \ * does not have a GPUContext. */ - BLI_assert(GLContext::get() != NULL); + BLI_assert(GLContext::get() != nullptr); #endif /* Invalid handles are silently ignored. */ glDeleteShader(vert_shader_); diff --git a/source/blender/io/CMakeLists.txt b/source/blender/io/CMakeLists.txt index f11ad7627b9..b97b3ef97de 100644 --- a/source/blender/io/CMakeLists.txt +++ b/source/blender/io/CMakeLists.txt @@ -19,6 +19,7 @@ # ***** END GPL LICENSE BLOCK ***** add_subdirectory(common) +add_subdirectory(wavefront_obj) if(WITH_ALEMBIC) add_subdirectory(alembic) diff --git a/source/blender/io/wavefront_obj/CMakeLists.txt b/source/blender/io/wavefront_obj/CMakeLists.txt new file mode 100644 index 00000000000..190475c5550 --- /dev/null +++ b/source/blender/io/wavefront_obj/CMakeLists.txt @@ -0,0 +1,84 @@ +# ***** BEGIN GPL LICENSE BLOCK ***** +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# ***** END GPL LICENSE BLOCK ***** + +set(INC + . + ./exporter + ../../blenkernel + ../../blenlib + ../../bmesh + ../../bmesh/intern + ../../depsgraph + ../../editors/include + ../../makesdna + ../../makesrna + ../../nodes + ../../windowmanager + ../../../../intern/guardedalloc +) + +set(INC_SYS + +) + +set(SRC + IO_wavefront_obj.cc + exporter/obj_exporter.cc + exporter/obj_export_file_writer.cc + exporter/obj_export_mesh.cc + exporter/obj_export_mtl.cc + exporter/obj_export_nurbs.cc + + IO_wavefront_obj.h + exporter/obj_exporter.hh + exporter/obj_export_file_writer.hh + exporter/obj_export_io.hh + exporter/obj_export_mesh.hh + exporter/obj_export_mtl.hh + exporter/obj_export_nurbs.hh +) + +set(LIB + bf_blenkernel +) + +blender_add_lib(bf_wavefront_obj "${SRC}" "${INC}" "${INC_SYS}" "${LIB}") + +if(WITH_GTESTS) + set(TEST_SRC + tests/obj_exporter_tests.cc + tests/obj_exporter_tests.hh + ) + + set(TEST_INC + ${INC} + + ../../blenloader + ../../../../tests/gtests + ) + + set(TEST_LIB + ${LIB} + + bf_blenloader_tests + bf_wavefront_obj + ) + + include(GTestTesting) + blender_add_test_lib(bf_wavefront_obj_tests "${TEST_SRC}" "${TEST_INC}" "${INC_SYS}" "${TEST_LIB}") + add_dependencies(bf_wavefront_obj_tests bf_wavefront_obj) +endif() diff --git a/source/blender/io/wavefront_obj/IO_wavefront_obj.cc b/source/blender/io/wavefront_obj/IO_wavefront_obj.cc new file mode 100644 index 00000000000..1c93eafe91a --- /dev/null +++ b/source/blender/io/wavefront_obj/IO_wavefront_obj.cc @@ -0,0 +1,34 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/** \file + * \ingroup obj + */ + +#include "BLI_timeit.hh" + +#include "IO_wavefront_obj.h" + +#include "obj_exporter.hh" + +/** + * C-interface for the exporter. + */ +void OBJ_export(bContext *C, const OBJExportParams *export_params) +{ + SCOPED_TIMER("OBJ export"); + blender::io::obj::exporter_main(C, *export_params); +} diff --git a/source/blender/io/wavefront_obj/IO_wavefront_obj.h b/source/blender/io/wavefront_obj/IO_wavefront_obj.h new file mode 100644 index 00000000000..25687fd957c --- /dev/null +++ b/source/blender/io/wavefront_obj/IO_wavefront_obj.h @@ -0,0 +1,97 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/** \file + * \ingroup obj + */ + +#pragma once + +#include "BKE_context.h" +#include "BLI_path_util.h" +#include "DEG_depsgraph.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { + OBJ_AXIS_X_UP = 0, + OBJ_AXIS_Y_UP = 1, + OBJ_AXIS_Z_UP = 2, + OBJ_AXIS_NEGATIVE_X_UP = 3, + OBJ_AXIS_NEGATIVE_Y_UP = 4, + OBJ_AXIS_NEGATIVE_Z_UP = 5, +} eTransformAxisUp; + +typedef enum { + OBJ_AXIS_X_FORWARD = 0, + OBJ_AXIS_Y_FORWARD = 1, + OBJ_AXIS_Z_FORWARD = 2, + OBJ_AXIS_NEGATIVE_X_FORWARD = 3, + OBJ_AXIS_NEGATIVE_Y_FORWARD = 4, + OBJ_AXIS_NEGATIVE_Z_FORWARD = 5, +} eTransformAxisForward; + +const int TOTAL_AXES = 3; + +struct OBJExportParams { + /** Full path to the destination .OBJ file. */ + char filepath[FILE_MAX]; + + /** Full path to current blender file (used for comments in output). */ + const char *blen_filepath; + + /** Whether multiple frames should be exported. */ + bool export_animation; + /** The first frame to be exported. */ + int start_frame; + /** The last frame to be exported. */ + int end_frame; + + /* Geometry Transform options. */ + eTransformAxisForward forward_axis; + eTransformAxisUp up_axis; + float scaling_factor; + + /* File Write Options. */ + bool export_selected_objects; + eEvaluationMode export_eval_mode; + bool export_uv; + bool export_normals; + bool export_materials; + bool export_triangulated_mesh; + bool export_curves_as_nurbs; + + /* Grouping options. */ + bool export_object_groups; + bool export_material_groups; + bool export_vertex_groups; + /** + * Calculate smooth groups from sharp edges. + */ + bool export_smooth_groups; + /** + * Create bitflags instead of the default "0"/"1" group IDs. + */ + bool smooth_groups_bitflags; +}; + +void OBJ_export(bContext *C, const struct OBJExportParams *export_params); + +#ifdef __cplusplus +} +#endif diff --git a/source/blender/io/wavefront_obj/exporter/obj_export_file_writer.cc b/source/blender/io/wavefront_obj/exporter/obj_export_file_writer.cc new file mode 100644 index 00000000000..d92d1c5ad48 --- /dev/null +++ b/source/blender/io/wavefront_obj/exporter/obj_export_file_writer.cc @@ -0,0 +1,626 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/** \file + * \ingroup obj + */ + +#include <algorithm> +#include <cstdio> + +#include "BKE_blender_version.h" + +#include "BLI_path_util.h" + +#include "obj_export_mesh.hh" +#include "obj_export_mtl.hh" +#include "obj_export_nurbs.hh" + +#include "obj_export_file_writer.hh" + +namespace blender::io::obj { +/** + * Per reference http://www.martinreddy.net/gfx/3d/OBJ.spec: + * To turn off smoothing groups, use a value of 0 or off. + * Polygonal elements use group numbers to put elements in different smoothing groups. + * For free-form surfaces, smoothing groups are either turned on or off; + * there is no difference between values greater than 0. + */ +const int SMOOTH_GROUP_DISABLED = 0; +const int SMOOTH_GROUP_DEFAULT = 1; + +const char *DEFORM_GROUP_DISABLED = "off"; +/* There is no deform group default name. Use what the user set in the UI. */ + +/** + * Per reference http://www.martinreddy.net/gfx/3d/OBJ.spec: + * Once a material is assigned, it cannot be turned off; it can only be changed. + * If a material name is not specified, a white material is used. + * So an empty material name is written. */ +const char *MATERIAL_GROUP_DISABLED = ""; + +/** + * Write one line of polygon indices as "f v1/vt1/vn1 v2/vt2/vn2 ...". + */ +void OBJWriter::write_vert_uv_normal_indices(Span<int> vert_indices, + Span<int> uv_indices, + Span<int> normal_indices) const +{ + BLI_assert(vert_indices.size() == uv_indices.size() && + vert_indices.size() == normal_indices.size()); + file_handler_->write<eOBJSyntaxElement::poly_element_begin>(); + for (int j = 0; j < vert_indices.size(); j++) { + file_handler_->write<eOBJSyntaxElement::vertex_uv_normal_indices>( + vert_indices[j] + index_offsets_.vertex_offset + 1, + uv_indices[j] + index_offsets_.uv_vertex_offset + 1, + normal_indices[j] + index_offsets_.normal_offset + 1); + } + file_handler_->write<eOBJSyntaxElement::poly_element_end>(); +} + +/** + * Write one line of polygon indices as "f v1//vn1 v2//vn2 ...". + */ +void OBJWriter::write_vert_normal_indices(Span<int> vert_indices, + Span<int> /*uv_indices*/, + Span<int> normal_indices) const +{ + BLI_assert(vert_indices.size() == normal_indices.size()); + file_handler_->write<eOBJSyntaxElement::poly_element_begin>(); + for (int j = 0; j < vert_indices.size(); j++) { + file_handler_->write<eOBJSyntaxElement::vertex_normal_indices>( + vert_indices[j] + index_offsets_.vertex_offset + 1, + normal_indices[j] + index_offsets_.normal_offset + 1); + } + file_handler_->write<eOBJSyntaxElement::poly_element_end>(); +} + +/** + * Write one line of polygon indices as "f v1/vt1 v2/vt2 ...". + */ +void OBJWriter::write_vert_uv_indices(Span<int> vert_indices, + Span<int> uv_indices, + Span<int> /*normal_indices*/) const +{ + BLI_assert(vert_indices.size() == uv_indices.size()); + file_handler_->write<eOBJSyntaxElement::poly_element_begin>(); + for (int j = 0; j < vert_indices.size(); j++) { + file_handler_->write<eOBJSyntaxElement::vertex_uv_indices>( + vert_indices[j] + index_offsets_.vertex_offset + 1, + uv_indices[j] + index_offsets_.uv_vertex_offset + 1); + } + file_handler_->write<eOBJSyntaxElement::poly_element_end>(); +} + +/** + * Write one line of polygon indices as "f v1 v2 ...". + */ +void OBJWriter::write_vert_indices(Span<int> vert_indices, + Span<int> /*uv_indices*/, + Span<int> /*normal_indices*/) const +{ + file_handler_->write<eOBJSyntaxElement::poly_element_begin>(); + for (const int vert_index : vert_indices) { + file_handler_->write<eOBJSyntaxElement::vertex_indices>(vert_index + + index_offsets_.vertex_offset + 1); + } + file_handler_->write<eOBJSyntaxElement::poly_element_end>(); +} + +void OBJWriter::write_header() const +{ + using namespace std::string_literals; + file_handler_->write<eOBJSyntaxElement::string>("# Blender "s + BKE_blender_version_string() + + "\n"); + file_handler_->write<eOBJSyntaxElement::string>("# www.blender.org\n"); +} + +/** + * Write file name of Material Library in .OBJ file. + */ +void OBJWriter::write_mtllib_name(const StringRefNull mtl_filepath) const +{ + /* Split .MTL file path into parent directory and filename. */ + char mtl_file_name[FILE_MAXFILE]; + char mtl_dir_name[FILE_MAXDIR]; + BLI_split_dirfile(mtl_filepath.data(), mtl_dir_name, mtl_file_name, FILE_MAXDIR, FILE_MAXFILE); + file_handler_->write<eOBJSyntaxElement::mtllib>(mtl_file_name); +} + +/** + * Write an object's group with mesh and/or material name appended conditionally. + */ +void OBJWriter::write_object_group(const OBJMesh &obj_mesh_data) const +{ + /* "o object_name" is not mandatory. A valid .OBJ file may contain neither + * "o name" nor "g group_name". */ + BLI_assert(export_params_.export_object_groups); + if (!export_params_.export_object_groups) { + return; + } + const std::string object_name = obj_mesh_data.get_object_name(); + const char *object_mesh_name = obj_mesh_data.get_object_mesh_name(); + const char *object_material_name = obj_mesh_data.get_object_material_name(0); + if (export_params_.export_materials && export_params_.export_material_groups && + object_material_name) { + file_handler_->write<eOBJSyntaxElement::object_group>(object_name + "_" + object_mesh_name + + "_" + object_material_name); + return; + } + file_handler_->write<eOBJSyntaxElement::object_group>(object_name + "_" + object_mesh_name); +} + +/** + * Write object's name or group. + */ +void OBJWriter::write_object_name(const OBJMesh &obj_mesh_data) const +{ + const char *object_name = obj_mesh_data.get_object_name(); + if (export_params_.export_object_groups) { + write_object_group(obj_mesh_data); + return; + } + file_handler_->write<eOBJSyntaxElement::object_name>(object_name); +} + +/** + * Write vertex coordinates for all vertices as "v x y z". + */ +void OBJWriter::write_vertex_coords(const OBJMesh &obj_mesh_data) const +{ + const int tot_vertices = obj_mesh_data.tot_vertices(); + for (int i = 0; i < tot_vertices; i++) { + float3 vertex = obj_mesh_data.calc_vertex_coords(i, export_params_.scaling_factor); + file_handler_->write<eOBJSyntaxElement::vertex_coords>(vertex[0], vertex[1], vertex[2]); + } +} + +/** + * Write UV vertex coordinates for all vertices as "vt u v". + * \note UV indices are stored here, but written later. + */ +void OBJWriter::write_uv_coords(OBJMesh &r_obj_mesh_data) const +{ + Vector<std::array<float, 2>> uv_coords; + /* UV indices are calculated and stored in an OBJMesh member here. */ + r_obj_mesh_data.store_uv_coords_and_indices(uv_coords); + + for (const std::array<float, 2> &uv_vertex : uv_coords) { + file_handler_->write<eOBJSyntaxElement::uv_vertex_coords>(uv_vertex[0], uv_vertex[1]); + } +} + +/** + * Write loop normals for smooth-shaded polygons, and polygon normals otherwise, as "vn x y z". + */ +void OBJWriter::write_poly_normals(const OBJMesh &obj_mesh_data) const +{ + obj_mesh_data.ensure_mesh_normals(); + Vector<float3> lnormals; + const int tot_polygons = obj_mesh_data.tot_polygons(); + for (int i = 0; i < tot_polygons; i++) { + if (obj_mesh_data.is_ith_poly_smooth(i)) { + obj_mesh_data.calc_loop_normals(i, lnormals); + for (const float3 &lnormal : lnormals) { + file_handler_->write<eOBJSyntaxElement::normal>(lnormal[0], lnormal[1], lnormal[2]); + } + } + else { + float3 poly_normal = obj_mesh_data.calc_poly_normal(i); + file_handler_->write<eOBJSyntaxElement::normal>( + poly_normal[0], poly_normal[1], poly_normal[2]); + } + } +} + +/** + * Write smooth group if polygon at the given index is shaded smooth else "s 0" + */ +int OBJWriter::write_smooth_group(const OBJMesh &obj_mesh_data, + const int poly_index, + const int last_poly_smooth_group) const +{ + int current_group = SMOOTH_GROUP_DISABLED; + if (!export_params_.export_smooth_groups && obj_mesh_data.is_ith_poly_smooth(poly_index)) { + /* Smooth group calculation is disabled, but polygon is smooth-shaded. */ + current_group = SMOOTH_GROUP_DEFAULT; + } + else if (obj_mesh_data.is_ith_poly_smooth(poly_index)) { + /* Smooth group calc is enabled and polygon is smooth–shaded, so find the group. */ + current_group = obj_mesh_data.ith_smooth_group(poly_index); + } + + if (current_group == last_poly_smooth_group) { + /* Group has already been written, even if it is "s 0". */ + return current_group; + } + file_handler_->write<eOBJSyntaxElement::smooth_group>(current_group); + return current_group; +} + +/** + * Write material name and material group of a polygon in the .OBJ file. + * \return #mat_nr of the polygon at the given index. + * \note It doesn't write to the material library. + */ +int16_t OBJWriter::write_poly_material(const OBJMesh &obj_mesh_data, + const int poly_index, + const int16_t last_poly_mat_nr, + std::function<const char *(int)> matname_fn) const +{ + if (!export_params_.export_materials || obj_mesh_data.tot_materials() <= 0) { + return last_poly_mat_nr; + } + const int16_t current_mat_nr = obj_mesh_data.ith_poly_matnr(poly_index); + /* Whenever a polygon with a new material is encountered, write its material + * and/or group, otherwise pass. */ + if (last_poly_mat_nr == current_mat_nr) { + return current_mat_nr; + } + if (current_mat_nr == NOT_FOUND) { + file_handler_->write<eOBJSyntaxElement::poly_usemtl>(MATERIAL_GROUP_DISABLED); + return current_mat_nr; + } + if (export_params_.export_object_groups) { + write_object_group(obj_mesh_data); + } + const char *mat_name = matname_fn(current_mat_nr); + if (!mat_name) { + mat_name = MATERIAL_GROUP_DISABLED; + } + file_handler_->write<eOBJSyntaxElement::poly_usemtl>(mat_name); + + return current_mat_nr; +} + +/** + * Write the name of the deform group of a polygon. + */ +int16_t OBJWriter::write_vertex_group(const OBJMesh &obj_mesh_data, + const int poly_index, + const int16_t last_poly_vertex_group) const +{ + if (!export_params_.export_vertex_groups) { + return last_poly_vertex_group; + } + const int16_t current_group = obj_mesh_data.get_poly_deform_group_index(poly_index); + + if (current_group == last_poly_vertex_group) { + /* No vertex group found in this polygon, just like in the last iteration. */ + return current_group; + } + if (current_group == NOT_FOUND) { + file_handler_->write<eOBJSyntaxElement::object_group>(DEFORM_GROUP_DISABLED); + return current_group; + } + file_handler_->write<eOBJSyntaxElement::object_group>( + obj_mesh_data.get_poly_deform_group_name(current_group)); + return current_group; +} + +/** + * \return Writer function with appropriate polygon-element syntax. + */ +OBJWriter::func_vert_uv_normal_indices OBJWriter::get_poly_element_writer( + const int total_uv_vertices) const +{ + if (export_params_.export_normals) { + if (export_params_.export_uv && (total_uv_vertices > 0)) { + /* Write both normals and UV indices. */ + return &OBJWriter::write_vert_uv_normal_indices; + } + /* Write normals indices. */ + return &OBJWriter::write_vert_normal_indices; + } + /* Write UV indices. */ + if (export_params_.export_uv && (total_uv_vertices > 0)) { + return &OBJWriter::write_vert_uv_indices; + } + /* Write neither normals nor UV indices. */ + return &OBJWriter::write_vert_indices; +} + +/** + * Write polygon elements with at least vertex indices, and conditionally with UV vertex + * indices and polygon normal indices. Also write groups: smooth, vertex, material. + * The matname_fn turns a 0-indexed material slot number in an Object into the + * name used in the .obj file. + * \note UV indices were stored while writing UV vertices. + */ +void OBJWriter::write_poly_elements(const OBJMesh &obj_mesh_data, + std::function<const char *(int)> matname_fn) +{ + int last_poly_smooth_group = NEGATIVE_INIT; + int16_t last_poly_vertex_group = NEGATIVE_INIT; + int16_t last_poly_mat_nr = NEGATIVE_INIT; + + const func_vert_uv_normal_indices poly_element_writer = get_poly_element_writer( + obj_mesh_data.tot_uv_vertices()); + + /* Number of normals may not be equal to number of polygons due to smooth shading. */ + int per_object_tot_normals = 0; + const int tot_polygons = obj_mesh_data.tot_polygons(); + for (int i = 0; i < tot_polygons; i++) { + Vector<int> poly_vertex_indices = obj_mesh_data.calc_poly_vertex_indices(i); + Span<int> poly_uv_indices = obj_mesh_data.calc_poly_uv_indices(i); + /* For an Object, a normal index depends on how many of its normals have been written before + * it. This is unknown because of smooth shading. So pass "per object total normals" + * and update it after each call. */ + int new_normals = 0; + Vector<int> poly_normal_indices; + std::tie(new_normals, poly_normal_indices) = obj_mesh_data.calc_poly_normal_indices( + i, per_object_tot_normals); + per_object_tot_normals += new_normals; + + last_poly_smooth_group = write_smooth_group(obj_mesh_data, i, last_poly_smooth_group); + last_poly_vertex_group = write_vertex_group(obj_mesh_data, i, last_poly_vertex_group); + last_poly_mat_nr = write_poly_material(obj_mesh_data, i, last_poly_mat_nr, matname_fn); + (this->*poly_element_writer)(poly_vertex_indices, poly_uv_indices, poly_normal_indices); + } + /* Unusual: Other indices are updated in #OBJWriter::update_index_offsets. */ + index_offsets_.normal_offset += per_object_tot_normals; +} + +/** + * Write loose edges of a mesh as "l v1 v2". + */ +void OBJWriter::write_edges_indices(const OBJMesh &obj_mesh_data) const +{ + obj_mesh_data.ensure_mesh_edges(); + const int tot_edges = obj_mesh_data.tot_edges(); + for (int edge_index = 0; edge_index < tot_edges; edge_index++) { + const std::optional<std::array<int, 2>> vertex_indices = + obj_mesh_data.calc_loose_edge_vert_indices(edge_index); + if (!vertex_indices) { + continue; + } + file_handler_->write<eOBJSyntaxElement::edge>( + (*vertex_indices)[0] + index_offsets_.vertex_offset + 1, + (*vertex_indices)[1] + index_offsets_.vertex_offset + 1); + } +} + +/** + * Write a NURBS curve to the .OBJ file in parameter form. + */ +void OBJWriter::write_nurbs_curve(const OBJCurve &obj_nurbs_data) const +{ + const int total_splines = obj_nurbs_data.total_splines(); + for (int spline_idx = 0; spline_idx < total_splines; spline_idx++) { + const int total_vertices = obj_nurbs_data.total_spline_vertices(spline_idx); + for (int vertex_idx = 0; vertex_idx < total_vertices; vertex_idx++) { + const float3 vertex_coords = obj_nurbs_data.vertex_coordinates( + spline_idx, vertex_idx, export_params_.scaling_factor); + file_handler_->write<eOBJSyntaxElement::vertex_coords>( + vertex_coords[0], vertex_coords[1], vertex_coords[2]); + } + + const char *nurbs_name = obj_nurbs_data.get_curve_name(); + const int nurbs_degree = obj_nurbs_data.get_nurbs_degree(spline_idx); + file_handler_->write<eOBJSyntaxElement::object_group>(nurbs_name); + file_handler_->write<eOBJSyntaxElement::cstype>(); + file_handler_->write<eOBJSyntaxElement::nurbs_degree>(nurbs_degree); + /** + * The numbers written here are indices into the vertex coordinates written + * earlier, relative to the line that is going to be written. + * [0.0 - 1.0] is the curve parameter range. + * 0.0 1.0 -1 -2 -3 -4 for a non-cyclic curve with 4 vertices. + * 0.0 1.0 -1 -2 -3 -4 -1 -2 -3 for a cyclic curve with 4 vertices. + */ + const int total_control_points = obj_nurbs_data.total_spline_control_points(spline_idx); + file_handler_->write<eOBJSyntaxElement::curve_element_begin>(); + for (int i = 0; i < total_control_points; i++) { + /* "+1" to keep indices one-based, even if they're negative: i.e., -1 refers to the + * last vertex coordinate, -2 second last. */ + file_handler_->write<eOBJSyntaxElement::vertex_indices>(-((i % total_vertices) + 1)); + } + file_handler_->write<eOBJSyntaxElement::curve_element_end>(); + + /** + * In "parm u 0 0.1 .." line:, (total control points + 2) equidistant numbers in the + * parameter range are inserted. + */ + file_handler_->write<eOBJSyntaxElement::nurbs_parameter_begin>(); + for (int i = 1; i <= total_control_points + 2; i++) { + file_handler_->write<eOBJSyntaxElement::nurbs_parameters>(1.0f * i / + (total_control_points + 2 + 1)); + } + file_handler_->write<eOBJSyntaxElement::nurbs_parameter_end>(); + + file_handler_->write<eOBJSyntaxElement::nurbs_group_end>(); + } +} + +/** + * When there are multiple objects in a frame, the indices of previous objects' coordinates or + * normals add up. + */ +void OBJWriter::update_index_offsets(const OBJMesh &obj_mesh_data) +{ + index_offsets_.vertex_offset += obj_mesh_data.tot_vertices(); + index_offsets_.uv_vertex_offset += obj_mesh_data.tot_uv_vertices(); + /* Normal index is updated right after writing the normals. */ +} + +/* -------------------------------------------------------------------- */ +/** \name .MTL writers. + * \{ */ + +/** + * Convert #float3 to string of space-separated numbers, with no leading or trailing space. + * Only to be used in NON-performance-critical code. + */ +static std::string float3_to_string(const float3 &numbers) +{ + std::ostringstream r_string; + r_string << numbers[0] << " " << numbers[1] << " " << numbers[2]; + return r_string.str(); +}; + +/* + * Create the .MTL file. + */ +MTLWriter::MTLWriter(const char *obj_filepath) noexcept(false) +{ + mtl_filepath_ = obj_filepath; + const bool ok = BLI_path_extension_replace(mtl_filepath_.data(), FILE_MAX, ".mtl"); + if (!ok) { + throw std::system_error(ENAMETOOLONG, std::system_category(), ""); + } + file_handler_ = std::make_unique<FileHandler<eFileType::MTL>>(mtl_filepath_); +} + +void MTLWriter::write_header(const char *blen_filepath) const +{ + using namespace std::string_literals; + const char *blen_basename = (blen_filepath && blen_filepath[0] != '\0') ? + BLI_path_basename(blen_filepath) : + "None"; + file_handler_->write<eMTLSyntaxElement::string>("# Blender "s + BKE_blender_version_string() + + " MTL File: '" + blen_basename + "'\n"); + file_handler_->write<eMTLSyntaxElement::string>("# www.blender.org\n"); +} + +StringRefNull MTLWriter::mtl_file_path() const +{ + return mtl_filepath_; +} + +/** + * Write properties sourced from p-BSDF node or #Object.Material. + */ +void MTLWriter::write_bsdf_properties(const MTLMaterial &mtl_material) +{ + file_handler_->write<eMTLSyntaxElement::Ns>(mtl_material.Ns); + file_handler_->write<eMTLSyntaxElement::Ka>( + mtl_material.Ka.x, mtl_material.Ka.y, mtl_material.Ka.z); + file_handler_->write<eMTLSyntaxElement::Kd>( + mtl_material.Kd.x, mtl_material.Kd.y, mtl_material.Kd.z); + file_handler_->write<eMTLSyntaxElement::Ks>( + mtl_material.Ks.x, mtl_material.Ks.y, mtl_material.Ks.z); + file_handler_->write<eMTLSyntaxElement::Ke>( + mtl_material.Ke.x, mtl_material.Ke.y, mtl_material.Ke.z); + file_handler_->write<eMTLSyntaxElement::Ni>(mtl_material.Ni); + file_handler_->write<eMTLSyntaxElement::d>(mtl_material.d); + file_handler_->write<eMTLSyntaxElement::illum>(mtl_material.illum); +} + +/** + * Write a texture map in the form "map_XX -s 1. 1. 1. -o 0. 0. 0. [-bm 1.] path/to/image". + */ +void MTLWriter::write_texture_map( + const MTLMaterial &mtl_material, + const Map<const eMTLSyntaxElement, tex_map_XX>::Item &texture_map) +{ + std::string translation; + std::string scale; + std::string map_bump_strength; + /* Optional strings should have their own leading spaces. */ + if (texture_map.value.translation != float3{0.0f, 0.0f, 0.0f}) { + translation.append(" -s ").append(float3_to_string(texture_map.value.translation)); + } + if (texture_map.value.scale != float3{1.0f, 1.0f, 1.0f}) { + scale.append(" -o ").append(float3_to_string(texture_map.value.scale)); + } + if (texture_map.key == eMTLSyntaxElement::map_Bump && mtl_material.map_Bump_strength > 0.0001f) { + map_bump_strength.append(" -bm ").append(std::to_string(mtl_material.map_Bump_strength)); + } + +#define SYNTAX_DISPATCH(eMTLSyntaxElement) \ + if (texture_map.key == eMTLSyntaxElement) { \ + file_handler_->write<eMTLSyntaxElement>(translation + scale + map_bump_strength, \ + texture_map.value.image_path); \ + return; \ + } + + SYNTAX_DISPATCH(eMTLSyntaxElement::map_Kd); + SYNTAX_DISPATCH(eMTLSyntaxElement::map_Ks); + SYNTAX_DISPATCH(eMTLSyntaxElement::map_Ns); + SYNTAX_DISPATCH(eMTLSyntaxElement::map_d); + SYNTAX_DISPATCH(eMTLSyntaxElement::map_refl); + SYNTAX_DISPATCH(eMTLSyntaxElement::map_Ke); + SYNTAX_DISPATCH(eMTLSyntaxElement::map_Bump); + + BLI_assert(!"This map type was not written to the file."); +} + +/** + * Write all of the material specifications to the MTL file. + * For consistency of output from run to run (useful for testing), + * the materials are sorted by name before writing. + */ +void MTLWriter::write_materials() +{ + if (mtlmaterials_.size() == 0) { + return; + } + std::sort(mtlmaterials_.begin(), + mtlmaterials_.end(), + [](const MTLMaterial &a, const MTLMaterial &b) { return a.name < b.name; }); + for (const MTLMaterial &mtlmat : mtlmaterials_) { + file_handler_->write<eMTLSyntaxElement::string>("\n"); + file_handler_->write<eMTLSyntaxElement::newmtl>(mtlmat.name); + write_bsdf_properties(mtlmat); + for (const Map<const eMTLSyntaxElement, tex_map_XX>::Item &texture_map : + mtlmat.texture_maps.items()) { + if (!texture_map.value.image_path.empty()) { + write_texture_map(mtlmat, texture_map); + } + } + } +} + +/** + * Add the materials of the given object to MTLWriter, deduping + * against ones that are already there. + * Return a Vector of indices into mtlmaterials_ that hold the MTLMaterial + * that corresponds to each material slot, in order, of the given Object. + * Indexes are returned rather than pointers to the MTLMaterials themselves + * because the mtlmaterials_ Vector may move around when resized. + */ +Vector<int> MTLWriter::add_materials(const OBJMesh &mesh_to_export) +{ + Vector<int> r_mtl_indices; + r_mtl_indices.resize(mesh_to_export.tot_materials()); + for (int16_t i = 0; i < mesh_to_export.tot_materials(); i++) { + const Material *material = mesh_to_export.get_object_material(i); + if (!material) { + r_mtl_indices[i] = -1; + continue; + } + int mtlmat_index = material_map_.lookup_default(material, -1); + if (mtlmat_index != -1) { + r_mtl_indices[i] = mtlmat_index; + } + else { + mtlmaterials_.append(mtlmaterial_for_material(material)); + r_mtl_indices[i] = mtlmaterials_.size() - 1; + material_map_.add_new(material, r_mtl_indices[i]); + } + } + return r_mtl_indices; +} + +const char *MTLWriter::mtlmaterial_name(int index) +{ + if (index < 0 || index >= mtlmaterials_.size()) { + return nullptr; + } + return mtlmaterials_[index].name.c_str(); +} +/** \} */ + +} // namespace blender::io::obj diff --git a/source/blender/io/wavefront_obj/exporter/obj_export_file_writer.hh b/source/blender/io/wavefront_obj/exporter/obj_export_file_writer.hh new file mode 100644 index 00000000000..36d35ae370b --- /dev/null +++ b/source/blender/io/wavefront_obj/exporter/obj_export_file_writer.hh @@ -0,0 +1,132 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/** \file + * \ingroup obj + */ + +#pragma once + +#include "DNA_meshdata_types.h" + +#include "BLI_map.hh" +#include "BLI_vector.hh" + +#include "IO_wavefront_obj.h" +#include "obj_export_io.hh" +#include "obj_export_mtl.hh" + +namespace blender::io::obj { + +class OBJCurve; +class OBJMesh; +/** + * Total vertices/ UV vertices/ normals of previous Objects + * should be added to the current Object's indices. + */ +struct IndexOffsets { + int vertex_offset; + int uv_vertex_offset; + int normal_offset; +}; + +/** + * Responsible for writing a .OBJ file. + */ +class OBJWriter : NonMovable, NonCopyable { + private: + const OBJExportParams &export_params_; + std::unique_ptr<FileHandler<eFileType::OBJ>> file_handler_ = nullptr; + IndexOffsets index_offsets_{0, 0, 0}; + + public: + OBJWriter(const char *filepath, const OBJExportParams &export_params) noexcept(false) + : export_params_(export_params) + { + file_handler_ = std::make_unique<FileHandler<eFileType::OBJ>>(filepath); + } + + void write_header() const; + + void write_object_name(const OBJMesh &obj_mesh_data) const; + void write_object_group(const OBJMesh &obj_mesh_data) const; + void write_mtllib_name(const StringRefNull mtl_filepath) const; + void write_vertex_coords(const OBJMesh &obj_mesh_data) const; + void write_uv_coords(OBJMesh &obj_mesh_data) const; + void write_poly_normals(const OBJMesh &obj_mesh_data) const; + int write_smooth_group(const OBJMesh &obj_mesh_data, + int poly_index, + const int last_poly_smooth_group) const; + int16_t write_poly_material(const OBJMesh &obj_mesh_data, + const int poly_index, + const int16_t last_poly_mat_nr, + std::function<const char *(int)> matname_fn) const; + int16_t write_vertex_group(const OBJMesh &obj_mesh_data, + const int poly_index, + const int16_t last_poly_vertex_group) const; + void write_poly_elements(const OBJMesh &obj_mesh_data, + std::function<const char *(int)> matname_fn); + void write_edges_indices(const OBJMesh &obj_mesh_data) const; + void write_nurbs_curve(const OBJCurve &obj_nurbs_data) const; + + void update_index_offsets(const OBJMesh &obj_mesh_data); + + private: + using func_vert_uv_normal_indices = void (OBJWriter::*)(Span<int> vert_indices, + Span<int> uv_indices, + Span<int> normal_indices) const; + func_vert_uv_normal_indices get_poly_element_writer(const int total_uv_vertices) const; + + void write_vert_uv_normal_indices(Span<int> vert_indices, + Span<int> uv_indices, + Span<int> normal_indices) const; + void write_vert_normal_indices(Span<int> vert_indices, + Span<int> /*uv_indices*/, + Span<int> normal_indices) const; + void write_vert_uv_indices(Span<int> vert_indices, + Span<int> uv_indices, + Span<int> /*normal_indices*/) const; + void write_vert_indices(Span<int> vert_indices, + Span<int> /*uv_indices*/, + Span<int> /*normal_indices*/) const; +}; + +/** + * Responsible for writing a .MTL file. + */ +class MTLWriter : NonMovable, NonCopyable { + private: + std::unique_ptr<FileHandler<eFileType::MTL>> file_handler_ = nullptr; + std::string mtl_filepath_; + Vector<MTLMaterial> mtlmaterials_; + /* Map from a Material* to an index into mtlmaterials_. */ + Map<const Material *, int> material_map_; + + public: + MTLWriter(const char *obj_filepath) noexcept(false); + + void write_header(const char *blen_filepath) const; + void write_materials(); + StringRefNull mtl_file_path() const; + Vector<int> add_materials(const OBJMesh &mesh_to_export); + const char *mtlmaterial_name(int index); + + private: + void write_bsdf_properties(const MTLMaterial &mtl_material); + void write_texture_map(const MTLMaterial &mtl_material, + const Map<const eMTLSyntaxElement, tex_map_XX>::Item &texture_map); +}; +} // namespace blender::io::obj diff --git a/source/blender/io/wavefront_obj/exporter/obj_export_io.hh b/source/blender/io/wavefront_obj/exporter/obj_export_io.hh new file mode 100644 index 00000000000..83571d8aa46 --- /dev/null +++ b/source/blender/io/wavefront_obj/exporter/obj_export_io.hh @@ -0,0 +1,340 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/** \file + * \ingroup obj + */ + +#pragma once + +#include <cstdio> +#include <string> +#include <system_error> +#include <type_traits> + +#include "BLI_compiler_attrs.h" +#include "BLI_string_ref.hh" +#include "BLI_utility_mixins.hh" + +namespace blender::io::obj { + +enum class eFileType { + OBJ, + MTL, +}; + +enum class eOBJSyntaxElement { + vertex_coords, + uv_vertex_coords, + normal, + poly_element_begin, + vertex_uv_normal_indices, + vertex_normal_indices, + vertex_uv_indices, + vertex_indices, + poly_element_end, + poly_usemtl, + edge, + cstype, + nurbs_degree, + curve_element_begin, + curve_element_end, + nurbs_parameter_begin, + nurbs_parameters, + nurbs_parameter_end, + nurbs_group_end, + new_line, + mtllib, + smooth_group, + object_group, + object_name, + /* Use rarely. New line is NOT included for string. */ + string, +}; + +enum class eMTLSyntaxElement { + newmtl, + Ni, + d, + Ns, + illum, + Ka, + Kd, + Ks, + Ke, + map_Kd, + map_Ks, + map_Ns, + map_d, + map_refl, + map_Ke, + map_Bump, + /* Use rarely. New line is NOT included for string. */ + string, +}; + +template<eFileType filetype> struct FileTypeTraits; + +template<> struct FileTypeTraits<eFileType::OBJ> { + using SyntaxType = eOBJSyntaxElement; +}; + +template<> struct FileTypeTraits<eFileType::MTL> { + using SyntaxType = eMTLSyntaxElement; +}; + +template<eFileType type> struct Formatting { + const char *fmt = nullptr; + const int total_args = 0; + /* Fail to compile by default. */ + const bool is_type_valid = false; +}; + +/** + * Type dependent but always false. Use to add a conditional compile-time error. + */ +template<typename T> struct always_false : std::false_type { +}; + +template<typename... T> +constexpr bool is_type_float = (... && std::is_floating_point_v<std::decay_t<T>>); + +template<typename... T> +constexpr bool is_type_integral = (... && std::is_integral_v<std::decay_t<T>>); + +template<typename... T> +constexpr bool is_type_string_related = (... && std::is_constructible_v<std::string, T>); + +template<eFileType filetype, typename... T> +constexpr std::enable_if_t<filetype == eFileType::OBJ, Formatting<filetype>> +syntax_elem_to_formatting(const eOBJSyntaxElement key) +{ + switch (key) { + case eOBJSyntaxElement::vertex_coords: { + return {"v %f %f %f\n", 3, is_type_float<T...>}; + } + case eOBJSyntaxElement::uv_vertex_coords: { + return {"vt %f %f\n", 2, is_type_float<T...>}; + } + case eOBJSyntaxElement::normal: { + return {"vn %f %f %f\n", 3, is_type_float<T...>}; + } + case eOBJSyntaxElement::poly_element_begin: { + return {"f", 0, is_type_string_related<T...>}; + } + case eOBJSyntaxElement::vertex_uv_normal_indices: { + return {" %d/%d/%d", 3, is_type_integral<T...>}; + } + case eOBJSyntaxElement::vertex_normal_indices: { + return {" %d//%d", 2, is_type_integral<T...>}; + } + case eOBJSyntaxElement::vertex_uv_indices: { + return {" %d/%d", 2, is_type_integral<T...>}; + } + case eOBJSyntaxElement::vertex_indices: { + return {" %d", 1, is_type_integral<T...>}; + } + case eOBJSyntaxElement::poly_usemtl: { + return {"usemtl %s\n", 1, is_type_string_related<T...>}; + } + case eOBJSyntaxElement::edge: { + return {"l %d %d\n", 2, is_type_integral<T...>}; + } + case eOBJSyntaxElement::cstype: { + return {"cstype bspline\n", 0, is_type_string_related<T...>}; + } + case eOBJSyntaxElement::nurbs_degree: { + return {"deg %d\n", 1, is_type_integral<T...>}; + } + case eOBJSyntaxElement::curve_element_begin: { + return {"curv 0.0 1.0", 0, is_type_string_related<T...>}; + } + case eOBJSyntaxElement::nurbs_parameter_begin: { + return {"parm 0.0", 0, is_type_string_related<T...>}; + } + case eOBJSyntaxElement::nurbs_parameters: { + return {" %f", 1, is_type_float<T...>}; + } + case eOBJSyntaxElement::nurbs_parameter_end: { + return {" 1.0\n", 0, is_type_string_related<T...>}; + } + case eOBJSyntaxElement::nurbs_group_end: { + return {"end\n", 0, is_type_string_related<T...>}; + } + case eOBJSyntaxElement::poly_element_end: { + ATTR_FALLTHROUGH; + } + case eOBJSyntaxElement::curve_element_end: { + ATTR_FALLTHROUGH; + } + case eOBJSyntaxElement::new_line: { + return {"\n", 0, is_type_string_related<T...>}; + } + case eOBJSyntaxElement::mtllib: { + return {"mtllib %s\n", 1, is_type_string_related<T...>}; + } + case eOBJSyntaxElement::smooth_group: { + return {"s %d\n", 1, is_type_integral<T...>}; + } + case eOBJSyntaxElement::object_group: { + return {"g %s\n", 1, is_type_string_related<T...>}; + } + case eOBJSyntaxElement::object_name: { + return {"o %s\n", 1, is_type_string_related<T...>}; + } + case eOBJSyntaxElement::string: { + return {"%s", 1, is_type_string_related<T...>}; + } + } +} + +template<eFileType filetype, typename... T> +constexpr std::enable_if_t<filetype == eFileType::MTL, Formatting<filetype>> +syntax_elem_to_formatting(const eMTLSyntaxElement key) +{ + switch (key) { + case eMTLSyntaxElement::newmtl: { + return {"newmtl %s\n", 1, is_type_string_related<T...>}; + } + case eMTLSyntaxElement::Ni: { + return {"Ni %.6f\n", 1, is_type_float<T...>}; + } + case eMTLSyntaxElement::d: { + return {"d %.6f\n", 1, is_type_float<T...>}; + } + case eMTLSyntaxElement::Ns: { + return {"Ns %.6f\n", 1, is_type_float<T...>}; + } + case eMTLSyntaxElement::illum: { + return {"illum %d\n", 1, is_type_integral<T...>}; + } + case eMTLSyntaxElement::Ka: { + return {"Ka %.6f %.6f %.6f\n", 3, is_type_float<T...>}; + } + case eMTLSyntaxElement::Kd: { + return {"Kd %.6f %.6f %.6f\n", 3, is_type_float<T...>}; + } + case eMTLSyntaxElement::Ks: { + return {"Ks %.6f %.6f %.6f\n", 3, is_type_float<T...>}; + } + case eMTLSyntaxElement::Ke: { + return {"Ke %.6f %.6f %.6f\n", 3, is_type_float<T...>}; + } + /* Keep only one space between options since filepaths may have leading spaces too. */ + case eMTLSyntaxElement::map_Kd: { + return {"map_Kd %s %s\n", 2, is_type_string_related<T...>}; + } + case eMTLSyntaxElement::map_Ks: { + return {"map_Ks %s %s\n", 2, is_type_string_related<T...>}; + } + case eMTLSyntaxElement::map_Ns: { + return {"map_Ns %s %s\n", 2, is_type_string_related<T...>}; + } + case eMTLSyntaxElement::map_d: { + return {"map_d %s %s\n", 2, is_type_string_related<T...>}; + } + case eMTLSyntaxElement::map_refl: { + return {"map_refl %s %s\n", 2, is_type_string_related<T...>}; + } + case eMTLSyntaxElement::map_Ke: { + return {"map_Ke %s %s\n", 2, is_type_string_related<T...>}; + } + case eMTLSyntaxElement::map_Bump: { + return {"map_Bump %s %s\n", 2, is_type_string_related<T...>}; + } + case eMTLSyntaxElement::string: { + return {"%s", 1, is_type_string_related<T...>}; + } + } +} + +template<eFileType filetype> class FileHandler : NonCopyable, NonMovable { + private: + FILE *outfile_ = nullptr; + std::string outfile_path_; + + public: + FileHandler(std::string outfile_path) noexcept(false) : outfile_path_(std::move(outfile_path)) + { + outfile_ = std::fopen(outfile_path_.c_str(), "w"); + if (!outfile_) { + throw std::system_error(errno, std::system_category(), "Cannot open file"); + } + } + + ~FileHandler() + { + if (outfile_ && std::fclose(outfile_)) { + std::cerr << "Error: could not close the file '" << outfile_path_ + << "' properly, it may be corrupted." << std::endl; + } + } + + template<typename FileTypeTraits<filetype>::SyntaxType key, typename... T> + constexpr void write(T &&...args) const + { + constexpr Formatting<filetype> fmt_nargs_valid = syntax_elem_to_formatting<filetype, T...>( + key); + write__impl<fmt_nargs_valid.total_args>(fmt_nargs_valid.fmt, std::forward<T>(args)...); + /* Types of all arguments and the number of arguments should match + * what the formatting specifies. */ + return std::enable_if_t < fmt_nargs_valid.is_type_valid && + (sizeof...(T) == fmt_nargs_valid.total_args), + void > (); + } + + private: + /* Remove this after upgrading to C++20. */ + template<typename T> using remove_cvref_t = std::remove_cv_t<std::remove_reference_t<T>>; + + /** + * Make #std::string etc., usable for fprintf-family. + * \return: `const char *` or the original argument if the argument is + * not related to #std::string. + */ + template<typename T> constexpr auto string_to_primitive(T &&arg) const + { + if constexpr (std::is_same_v<remove_cvref_t<T>, std::string> || + std::is_same_v<remove_cvref_t<T>, blender::StringRefNull>) { + return arg.c_str(); + } + else if constexpr (std::is_same_v<remove_cvref_t<T>, blender::StringRef>) { + BLI_STATIC_ASSERT( + (always_false<T>::value), + "Null-terminated string not present. Please use blender::StringRefNull instead."); + /* Another trick to cause a compile-time error: returning nothing to #std::printf. */ + return; + } + else { + return std::forward<T>(arg); + } + } + + template<int total_args, typename... T> + constexpr std::enable_if_t<(total_args != 0), void> write__impl(const char *fmt, + T &&...args) const + { + std::fprintf(outfile_, fmt, string_to_primitive(std::forward<T>(args))...); + } + template<int total_args, typename... T> + constexpr std::enable_if_t<(total_args == 0), void> write__impl(const char *fmt, + T &&...args) const + { + std::fputs(fmt, outfile_); + } +}; + +} // namespace blender::io::obj diff --git a/source/blender/io/wavefront_obj/exporter/obj_export_mesh.cc b/source/blender/io/wavefront_obj/exporter/obj_export_mesh.cc new file mode 100644 index 00000000000..0947d1132b0 --- /dev/null +++ b/source/blender/io/wavefront_obj/exporter/obj_export_mesh.cc @@ -0,0 +1,489 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/** \file + * \ingroup obj + */ + +#include "BKE_customdata.h" +#include "BKE_deform.h" +#include "BKE_lib_id.h" +#include "BKE_material.h" +#include "BKE_mesh.h" +#include "BKE_mesh_mapping.h" +#include "BKE_object.h" + +#include "BLI_listbase.h" +#include "BLI_math.h" + +#include "DEG_depsgraph_query.h" + +#include "DNA_material_types.h" +#include "DNA_mesh_types.h" +#include "DNA_modifier_types.h" +#include "DNA_object_types.h" + +#include "obj_export_mesh.hh" + +namespace blender::io::obj { +/** + * Store evaluated Object and Mesh pointers. Conditionally triangulate a mesh, or + * create a new Mesh from a Curve. + */ +OBJMesh::OBJMesh(Depsgraph *depsgraph, const OBJExportParams &export_params, Object *mesh_object) +{ + export_object_eval_ = DEG_get_evaluated_object(depsgraph, mesh_object); + export_mesh_eval_ = BKE_object_get_evaluated_mesh(export_object_eval_); + mesh_eval_needs_free_ = false; + + if (!export_mesh_eval_) { + /* Curves and NURBS surfaces need a new mesh when they're + * exported in the form of vertices and edges. + */ + export_mesh_eval_ = BKE_mesh_new_from_object(depsgraph, export_object_eval_, true, true); + /* Since a new mesh been allocated, it needs to be freed in the destructor. */ + mesh_eval_needs_free_ = true; + } + if (export_params.export_triangulated_mesh && + ELEM(export_object_eval_->type, OB_MESH, OB_SURF)) { + std::tie(export_mesh_eval_, mesh_eval_needs_free_) = triangulate_mesh_eval(); + } + set_world_axes_transform(export_params.forward_axis, export_params.up_axis); +} + +/** + * Free new meshes allocated for triangulated meshes, or Curve converted to Mesh. + */ +OBJMesh::~OBJMesh() +{ + free_mesh_if_needed(); + if (poly_smooth_groups_) { + MEM_freeN(poly_smooth_groups_); + } +} + +/** + * Free the mesh if _the exporter_ created it. + */ +void OBJMesh::free_mesh_if_needed() +{ + if (mesh_eval_needs_free_ && export_mesh_eval_) { + BKE_id_free(nullptr, export_mesh_eval_); + } +} + +/** + * Allocate a new Mesh with triangulated polygons. + * + * The returned mesh can be the same as the old one. + * \return Owning pointer to the new Mesh, and whether a new Mesh was created. + */ +std::pair<Mesh *, bool> OBJMesh::triangulate_mesh_eval() +{ + if (export_mesh_eval_->totpoly <= 0) { + return {export_mesh_eval_, false}; + } + const struct BMeshCreateParams bm_create_params = {0u}; + const struct BMeshFromMeshParams bm_convert_params = {1u, 0, 0, 0}; + /* Lower threshold where triangulation of a polygon starts, i.e. a quadrilateral will be + * triangulated here. */ + const int triangulate_min_verts = 4; + + unique_bmesh_ptr bmesh( + BKE_mesh_to_bmesh_ex(export_mesh_eval_, &bm_create_params, &bm_convert_params)); + BM_mesh_triangulate(bmesh.get(), + MOD_TRIANGULATE_NGON_BEAUTY, + MOD_TRIANGULATE_QUAD_SHORTEDGE, + triangulate_min_verts, + false, + nullptr, + nullptr, + nullptr); + + Mesh *triangulated = BKE_mesh_from_bmesh_for_eval_nomain( + bmesh.get(), nullptr, export_mesh_eval_); + free_mesh_if_needed(); + return {triangulated, true}; +} + +/** + * Set the final transform after applying axes settings and an Object's world transform. + */ +void OBJMesh::set_world_axes_transform(const eTransformAxisForward forward, + const eTransformAxisUp up) +{ + float axes_transform[3][3]; + unit_m3(axes_transform); + /* +Y-forward and +Z-up are the default Blender axis settings. */ + mat3_from_axis_conversion(OBJ_AXIS_Y_FORWARD, OBJ_AXIS_Z_UP, forward, up, axes_transform); + /* mat3_from_axis_conversion returns a transposed matrix! */ + transpose_m3(axes_transform); + mul_m4_m3m4(world_and_axes_transform_, axes_transform, export_object_eval_->obmat); + /* mul_m4_m3m4 does not transform last row of obmat, i.e. location data. */ + mul_v3_m3v3(world_and_axes_transform_[3], axes_transform, export_object_eval_->obmat[3]); + world_and_axes_transform_[3][3] = export_object_eval_->obmat[3][3]; +} + +int OBJMesh::tot_vertices() const +{ + return export_mesh_eval_->totvert; +} + +int OBJMesh::tot_polygons() const +{ + return export_mesh_eval_->totpoly; +} + +int OBJMesh::tot_uv_vertices() const +{ + return tot_uv_vertices_; +} + +int OBJMesh::tot_edges() const +{ + return export_mesh_eval_->totedge; +} + +/** + * \return Total materials in the object. + */ +int16_t OBJMesh::tot_materials() const +{ + return export_mesh_eval_->totcol; +} + +/** + * \return Smooth group of the polygon at the given index. + */ +int OBJMesh::ith_smooth_group(const int poly_index) const +{ + /* Calculate smooth groups first: #OBJMesh::calc_smooth_groups. */ + BLI_assert(tot_smooth_groups_ != -NEGATIVE_INIT); + BLI_assert(poly_smooth_groups_); + return poly_smooth_groups_[poly_index]; +} + +void OBJMesh::ensure_mesh_normals() const +{ + BKE_mesh_ensure_normals(export_mesh_eval_); + BKE_mesh_calc_normals_split(export_mesh_eval_); +} + +void OBJMesh::ensure_mesh_edges() const +{ + BKE_mesh_calc_edges(export_mesh_eval_, true, false); + BKE_mesh_calc_edges_loose(export_mesh_eval_); +} + +/** + * Calculate smooth groups of a smooth-shaded object. + * \return A polygon aligned array of smooth group numbers. + */ +void OBJMesh::calc_smooth_groups(const bool use_bitflags) +{ + poly_smooth_groups_ = BKE_mesh_calc_smoothgroups(export_mesh_eval_->medge, + export_mesh_eval_->totedge, + export_mesh_eval_->mpoly, + export_mesh_eval_->totpoly, + export_mesh_eval_->mloop, + export_mesh_eval_->totloop, + &tot_smooth_groups_, + use_bitflags); +} + +/** + * Return mat_nr-th material of the object. The given index should be zero-based. + */ +const Material *OBJMesh::get_object_material(const int16_t mat_nr) const +{ + /* "+ 1" as material getter needs one-based indices. */ + const Material *r_mat = BKE_object_material_get(export_object_eval_, mat_nr + 1); +#ifdef DEBUG + if (!r_mat) { + std::cerr << "Material not found for mat_nr = " << mat_nr << std::endl; + } +#endif + return r_mat; +} + +bool OBJMesh::is_ith_poly_smooth(const int poly_index) const +{ + return export_mesh_eval_->mpoly[poly_index].flag & ME_SMOOTH; +} + +/** + * Returns a zero-based index of a polygon's material indexing into + * the Object's material slots. + */ +int16_t OBJMesh::ith_poly_matnr(const int poly_index) const +{ + BLI_assert(poly_index < export_mesh_eval_->totpoly); + const int16_t r_mat_nr = export_mesh_eval_->mpoly[poly_index].mat_nr; + return r_mat_nr >= 0 ? r_mat_nr : NOT_FOUND; +} + +/** + * Get object name as it appears in the outliner. + */ +const char *OBJMesh::get_object_name() const +{ + return export_object_eval_->id.name + 2; +} + +/** + * Get Object's Mesh's name. + */ +const char *OBJMesh::get_object_mesh_name() const +{ + return export_mesh_eval_->id.name + 2; +} + +/** + * Get object's material (at the given index) name. The given index should be zero-based. + */ +const char *OBJMesh::get_object_material_name(const int16_t mat_nr) const +{ + const Material *mat = get_object_material(mat_nr); + if (!mat) { + return nullptr; + } + return mat->id.name + 2; +} + +/** + * Calculate coordinates of the vertex at the given index. + */ +float3 OBJMesh::calc_vertex_coords(const int vert_index, const float scaling_factor) const +{ + float3 r_coords; + copy_v3_v3(r_coords, export_mesh_eval_->mvert[vert_index].co); + mul_v3_fl(r_coords, scaling_factor); + mul_m4_v3(world_and_axes_transform_, r_coords); + return r_coords; +} + +/** + * Calculate vertex indices of all vertices of the polygon at the given index. + */ +Vector<int> OBJMesh::calc_poly_vertex_indices(const int poly_index) const +{ + const MPoly &mpoly = export_mesh_eval_->mpoly[poly_index]; + const MLoop *mloop = &export_mesh_eval_->mloop[mpoly.loopstart]; + const int totloop = mpoly.totloop; + Vector<int> r_poly_vertex_indices(totloop); + for (int loop_index = 0; loop_index < totloop; loop_index++) { + r_poly_vertex_indices[loop_index] = mloop[loop_index].v; + } + return r_poly_vertex_indices; +} + +/** + * Calculate UV vertex coordinates of an Object. + * + * \note Also store the UV vertex indices in the member variable. + */ +void OBJMesh::store_uv_coords_and_indices(Vector<std::array<float, 2>> &r_uv_coords) +{ + const MPoly *mpoly = export_mesh_eval_->mpoly; + const MLoop *mloop = export_mesh_eval_->mloop; + const int totpoly = export_mesh_eval_->totpoly; + const int totvert = export_mesh_eval_->totvert; + const MLoopUV *mloopuv = static_cast<MLoopUV *>( + CustomData_get_layer(&export_mesh_eval_->ldata, CD_MLOOPUV)); + if (!mloopuv) { + tot_uv_vertices_ = 0; + return; + } + const float limit[2] = {STD_UV_CONNECT_LIMIT, STD_UV_CONNECT_LIMIT}; + + UvVertMap *uv_vert_map = BKE_mesh_uv_vert_map_create( + mpoly, mloop, mloopuv, totpoly, totvert, limit, false, false); + + uv_indices_.resize(totpoly); + /* At least total vertices of a mesh will be present in its texture map. So + * reserve minimum space early. */ + r_uv_coords.reserve(totvert); + + tot_uv_vertices_ = 0; + for (int vertex_index = 0; vertex_index < totvert; vertex_index++) { + const UvMapVert *uv_vert = BKE_mesh_uv_vert_map_get_vert(uv_vert_map, vertex_index); + for (; uv_vert; uv_vert = uv_vert->next) { + if (uv_vert->separate) { + tot_uv_vertices_ += 1; + } + const int vertices_in_poly = mpoly[uv_vert->poly_index].totloop; + + /* Store UV vertex coordinates. */ + r_uv_coords.resize(tot_uv_vertices_); + const int loopstart = mpoly[uv_vert->poly_index].loopstart; + Span<float> vert_uv_coords(mloopuv[loopstart + uv_vert->loop_of_poly_index].uv, 2); + r_uv_coords[tot_uv_vertices_ - 1][0] = vert_uv_coords[0]; + r_uv_coords[tot_uv_vertices_ - 1][1] = vert_uv_coords[1]; + + /* Store UV vertex indices. */ + uv_indices_[uv_vert->poly_index].resize(vertices_in_poly); + /* Keep indices zero-based and let the writer handle the "+ 1" as per OBJ spec. */ + uv_indices_[uv_vert->poly_index][uv_vert->loop_of_poly_index] = tot_uv_vertices_ - 1; + } + } + BKE_mesh_uv_vert_map_free(uv_vert_map); +} + +Span<int> OBJMesh::calc_poly_uv_indices(const int poly_index) const +{ + if (uv_indices_.size() <= 0) { + return {}; + } + BLI_assert(poly_index < export_mesh_eval_->totpoly); + BLI_assert(poly_index < uv_indices_.size()); + return uv_indices_[poly_index]; +} +/** + * Calculate polygon normal of a polygon at given index. + * + * Should be used for flat-shaded polygons. + */ +float3 OBJMesh::calc_poly_normal(const int poly_index) const +{ + float3 r_poly_normal; + const MPoly &poly = export_mesh_eval_->mpoly[poly_index]; + const MLoop &mloop = export_mesh_eval_->mloop[poly.loopstart]; + const MVert &mvert = *(export_mesh_eval_->mvert); + BKE_mesh_calc_poly_normal(&poly, &mloop, &mvert, r_poly_normal); + mul_mat3_m4_v3(world_and_axes_transform_, r_poly_normal); + return r_poly_normal; +} + +/** + * Calculate loop normals of a polygon at the given index. + * + * Should be used for smooth-shaded polygons. + */ +void OBJMesh::calc_loop_normals(const int poly_index, Vector<float3> &r_loop_normals) const +{ + r_loop_normals.clear(); + const MPoly &mpoly = export_mesh_eval_->mpoly[poly_index]; + const float( + *lnors)[3] = (const float(*)[3])(CustomData_get_layer(&export_mesh_eval_->ldata, CD_NORMAL)); + for (int loop_of_poly = 0; loop_of_poly < mpoly.totloop; loop_of_poly++) { + float3 loop_normal; + copy_v3_v3(loop_normal, lnors[mpoly.loopstart + loop_of_poly]); + mul_mat3_m4_v3(world_and_axes_transform_, loop_normal); + r_loop_normals.append(loop_normal); + } +} + +/** + * Calculate a polygon's polygon/loop normal indices. + * \param object_tot_prev_normals Number of normals of this Object written so far. + * \return Number of distinct normal indices. + */ +std::pair<int, Vector<int>> OBJMesh::calc_poly_normal_indices( + const int poly_index, const int object_tot_prev_normals) const +{ + const MPoly &mpoly = export_mesh_eval_->mpoly[poly_index]; + const int totloop = mpoly.totloop; + Vector<int> r_poly_normal_indices(totloop); + + if (is_ith_poly_smooth(poly_index)) { + for (int poly_loop_index = 0; poly_loop_index < totloop; poly_loop_index++) { + /* Using polygon loop index is fine because polygon/loop normals and their normal indices are + * written by looping over #Mesh.mpoly /#Mesh.mloop in the same order. */ + r_poly_normal_indices[poly_loop_index] = object_tot_prev_normals + poly_loop_index; + } + /* For a smooth-shaded polygon, #Mesh.totloop -many loop normals are written. */ + return {totloop, r_poly_normal_indices}; + } + for (int poly_loop_index = 0; poly_loop_index < totloop; poly_loop_index++) { + r_poly_normal_indices[poly_loop_index] = object_tot_prev_normals; + } + /* For a flat-shaded polygon, one polygon normal is written. */ + return {1, r_poly_normal_indices}; +} + +/** + * Find the index of the vertex group with the maximum number of vertices in a polygon. + * The index indices into the #Object.defbase. + * + * If two or more groups have the same number of vertices (maximum), group name depends on the + * implementation of #std::max_element. + */ +int16_t OBJMesh::get_poly_deform_group_index(const int poly_index) const +{ + BLI_assert(poly_index < export_mesh_eval_->totpoly); + const MPoly &mpoly = export_mesh_eval_->mpoly[poly_index]; + const MLoop *mloop = &export_mesh_eval_->mloop[mpoly.loopstart]; + const Object *obj = export_object_eval_; + const int tot_deform_groups = BKE_object_defgroup_count(obj); + /* Indices of the vector index into deform groups of an object; values are the] + * number of vertex members in one deform group. */ + Vector<int16_t> deform_group_members(tot_deform_groups, 0); + /* Whether at least one vertex in the polygon belongs to any group. */ + bool found_group = false; + + const MDeformVert *dvert_orig = static_cast<MDeformVert *>( + CustomData_get_layer(&export_mesh_eval_->vdata, CD_MDEFORMVERT)); + if (!dvert_orig) { + return NOT_FOUND; + } + + const MDeformWeight *curr_weight = nullptr; + const MDeformVert *dvert = nullptr; + for (int loop_index = 0; loop_index < mpoly.totloop; loop_index++) { + dvert = &dvert_orig[(mloop + loop_index)->v]; + curr_weight = dvert->dw; + if (curr_weight) { + bDeformGroup *vertex_group = static_cast<bDeformGroup *>( + BLI_findlink(BKE_object_defgroup_list(obj), curr_weight->def_nr)); + if (vertex_group) { + deform_group_members[curr_weight->def_nr] += 1; + found_group = true; + } + } + } + + if (!found_group) { + return NOT_FOUND; + } + /* Index of the group with maximum vertices. */ + int16_t max_idx = std::max_element(deform_group_members.begin(), deform_group_members.end()) - + deform_group_members.begin(); + return max_idx; +} + +/** + * Find the name of the vertex deform group at the given index. + * The index indices into the #Object.defbase. + */ +const char *OBJMesh::get_poly_deform_group_name(const int16_t def_group_index) const +{ + const bDeformGroup &vertex_group = *(static_cast<bDeformGroup *>( + BLI_findlink(BKE_object_defgroup_list(export_object_eval_), def_group_index))); + return vertex_group.name; +} + +/** + * Calculate vertex indices of an edge's corners if it is a loose edge. + */ +std::optional<std::array<int, 2>> OBJMesh::calc_loose_edge_vert_indices(const int edge_index) const +{ + const MEdge &edge = export_mesh_eval_->medge[edge_index]; + if (edge.flag & ME_LOOSEEDGE) { + return std::array<int, 2>{static_cast<int>(edge.v1), static_cast<int>(edge.v2)}; + } + return std::nullopt; +} +} // namespace blender::io::obj diff --git a/source/blender/io/wavefront_obj/exporter/obj_export_mesh.hh b/source/blender/io/wavefront_obj/exporter/obj_export_mesh.hh new file mode 100644 index 00000000000..d72dd76d447 --- /dev/null +++ b/source/blender/io/wavefront_obj/exporter/obj_export_mesh.hh @@ -0,0 +1,131 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/** \file + * \ingroup obj + */ + +#pragma once + +#include <optional> + +#include "BLI_float3.hh" +#include "BLI_utility_mixins.hh" +#include "BLI_vector.hh" + +#include "bmesh.h" +#include "bmesh_tools.h" + +#include "DNA_material_types.h" +#include "DNA_mesh_types.h" +#include "DNA_meshdata_types.h" + +#include "IO_wavefront_obj.h" + +namespace blender::io::obj { +/* Denote absence for usually non-negative numbers. */ +const int NOT_FOUND = -1; +/* Any negative number other than `NOT_FOUND` to initialise usually non-negative numbers. */ +const int NEGATIVE_INIT = -10; + +/** + * #std::unique_ptr deleter for BMesh. + */ +struct CustomBMeshDeleter { + void operator()(BMesh *bmesh) + { + if (bmesh) { + BM_mesh_free(bmesh); + } + } +}; + +using unique_bmesh_ptr = std::unique_ptr<BMesh, CustomBMeshDeleter>; + +class OBJMesh : NonCopyable { + private: + Object *export_object_eval_; + Mesh *export_mesh_eval_; + /** + * For curves which are converted to mesh, and triangulated meshes, a new mesh is allocated. + */ + bool mesh_eval_needs_free_ = false; + /** + * Final transform of an object obtained from export settings (up_axis, forward_axis) and the + * object's world transform matrix. + */ + float world_and_axes_transform_[4][4]; + + /** + * Total UV vertices in a mesh's texture map. + */ + int tot_uv_vertices_ = 0; + /** + * Per-polygon-per-vertex UV vertex indices. + */ + Vector<Vector<int>> uv_indices_; + /** + * Total smooth groups in an object. + */ + int tot_smooth_groups_ = NEGATIVE_INIT; + /** + * Polygon aligned array of their smooth groups. + */ + int *poly_smooth_groups_ = nullptr; + + public: + OBJMesh(Depsgraph *depsgraph, const OBJExportParams &export_params, Object *mesh_object); + ~OBJMesh(); + + int tot_vertices() const; + int tot_polygons() const; + int tot_uv_vertices() const; + int tot_edges() const; + + int16_t tot_materials() const; + const Material *get_object_material(const int16_t mat_nr) const; + int16_t ith_poly_matnr(const int poly_index) const; + + void ensure_mesh_normals() const; + void ensure_mesh_edges() const; + + void calc_smooth_groups(const bool use_bitflags); + int ith_smooth_group(const int poly_index) const; + bool is_ith_poly_smooth(const int poly_index) const; + + const char *get_object_name() const; + const char *get_object_mesh_name() const; + const char *get_object_material_name(const int16_t mat_nr) const; + + float3 calc_vertex_coords(const int vert_index, const float scaling_factor) const; + Vector<int> calc_poly_vertex_indices(const int poly_index) const; + void store_uv_coords_and_indices(Vector<std::array<float, 2>> &r_uv_coords); + Span<int> calc_poly_uv_indices(const int poly_index) const; + float3 calc_poly_normal(const int poly_index) const; + std::pair<int, Vector<int>> calc_poly_normal_indices(const int poly_index, + const int object_tot_prev_normals) const; + void calc_loop_normals(const int poly_index, Vector<float3> &r_loop_normals) const; + int16_t get_poly_deform_group_index(const int poly_index) const; + const char *get_poly_deform_group_name(const int16_t def_group_index) const; + + std::optional<std::array<int, 2>> calc_loose_edge_vert_indices(const int edge_index) const; + + private: + void free_mesh_if_needed(); + std::pair<Mesh *, bool> triangulate_mesh_eval(); + void set_world_axes_transform(const eTransformAxisForward forward, const eTransformAxisUp up); +}; +} // namespace blender::io::obj diff --git a/source/blender/io/wavefront_obj/exporter/obj_export_mtl.cc b/source/blender/io/wavefront_obj/exporter/obj_export_mtl.cc new file mode 100644 index 00000000000..b60f8976177 --- /dev/null +++ b/source/blender/io/wavefront_obj/exporter/obj_export_mtl.cc @@ -0,0 +1,362 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/** \file + * \ingroup obj + */ + +#include "BKE_image.h" +#include "BKE_node.h" + +#include "BLI_float3.hh" +#include "BLI_map.hh" +#include "BLI_path_util.h" + +#include "DNA_material_types.h" +#include "DNA_node_types.h" + +#include "NOD_node_tree_ref.hh" + +#include "obj_export_mesh.hh" +#include "obj_export_mtl.hh" + +namespace blender::io::obj { + +/** + * Copy a float property of the given type from the bNode to given buffer. + */ +static void copy_property_from_node(const eNodeSocketDatatype property_type, + const bNode *node, + const char *identifier, + MutableSpan<float> r_property) +{ + if (!node) { + return; + } + bNodeSocket *socket{nodeFindSocket(node, SOCK_IN, identifier)}; + BLI_assert(socket && socket->type == property_type); + if (!socket) { + return; + } + switch (property_type) { + case SOCK_FLOAT: { + BLI_assert(r_property.size() == 1); + bNodeSocketValueFloat *socket_def_value = static_cast<bNodeSocketValueFloat *>( + socket->default_value); + r_property[0] = socket_def_value->value; + break; + } + case SOCK_RGBA: { + BLI_assert(r_property.size() == 3); + bNodeSocketValueRGBA *socket_def_value = static_cast<bNodeSocketValueRGBA *>( + socket->default_value); + copy_v3_v3(r_property.data(), socket_def_value->value); + break; + } + case SOCK_VECTOR: { + BLI_assert(r_property.size() == 3); + bNodeSocketValueVector *socket_def_value = static_cast<bNodeSocketValueVector *>( + socket->default_value); + copy_v3_v3(r_property.data(), socket_def_value->value); + break; + } + default: { + /* Other socket types are not handled here. */ + BLI_assert(0); + break; + } + } +} + +/** + * Collect all the source sockets linked to the destination socket in a destination node. + */ +static void linked_sockets_to_dest_id(const bNode *dest_node, + const nodes::NodeTreeRef &node_tree, + StringRefNull dest_socket_id, + Vector<const nodes::OutputSocketRef *> &r_linked_sockets) +{ + r_linked_sockets.clear(); + if (!dest_node) { + return; + } + Span<const nodes::NodeRef *> object_dest_nodes = node_tree.nodes_by_type(dest_node->idname); + Span<const nodes::InputSocketRef *> dest_inputs = object_dest_nodes.first()->inputs(); + const nodes::InputSocketRef *dest_socket = nullptr; + for (const nodes::InputSocketRef *curr_socket : dest_inputs) { + if (STREQ(curr_socket->bsocket()->identifier, dest_socket_id.c_str())) { + dest_socket = curr_socket; + break; + } + } + if (dest_socket) { + Span<const nodes::OutputSocketRef *> linked_sockets = dest_socket->directly_linked_sockets(); + r_linked_sockets.resize(linked_sockets.size()); + r_linked_sockets = linked_sockets; + } +} + +/** + * From a list of sockets, get the parent node which is of the given node type. + */ +static const bNode *get_node_of_type(Span<const nodes::OutputSocketRef *> sockets_list, + const int node_type) +{ + for (const nodes::SocketRef *socket : sockets_list) { + const bNode *parent_node = socket->bnode(); + if (parent_node->typeinfo->type == node_type) { + return parent_node; + } + } + return nullptr; +} + +/** + * From a texture image shader node, get the image's filepath. + * Returned filepath is stripped of initial "//". If packed image is found, + * only the file "name" is returned. + */ +static const char *get_image_filepath(const bNode *tex_node) +{ + if (!tex_node) { + return nullptr; + } + Image *tex_image = reinterpret_cast<Image *>(tex_node->id); + if (!tex_image || !BKE_image_has_filepath(tex_image)) { + return nullptr; + } + const char *path = tex_image->filepath; + if (BKE_image_has_packedfile(tex_image)) { + /* Put image in the same directory as the .MTL file. */ + path = BLI_path_slash_rfind(path) + 1; + fprintf(stderr, + "Packed image found:'%s'. Unpack and place the image in the same " + "directory as the .MTL file.\n", + path); + } + if (path[0] == '/' && path[1] == '/') { + path += 2; + } + return path; +} + +/** + * Find the Principled-BSDF Node in nodetree. + * We only want one that feeds directly into a Material Output node + * (that is the behavior of the legacy Python exporter). + */ +static const nodes::NodeRef *find_bsdf_node(const nodes::NodeTreeRef *nodetree) +{ + if (!nodetree) { + return nullptr; + } + for (const nodes::NodeRef *node : nodetree->nodes_by_type("ShaderNodeOutputMaterial")) { + const nodes::InputSocketRef *node_input_socket0 = node->inputs()[0]; + for (const nodes::OutputSocketRef *out_sock : node_input_socket0->directly_linked_sockets()) { + const nodes::NodeRef &in_node = out_sock->node(); + if (in_node.typeinfo()->type == SH_NODE_BSDF_PRINCIPLED) { + return &in_node; + } + } + } + return nullptr; +} + +/** + * Store properties found either in bNode or material into r_mtl_mat. + */ +static void store_bsdf_properties(const nodes::NodeRef *bsdf_node, + const Material *material, + MTLMaterial &r_mtl_mat) +{ + const bNode *bnode = nullptr; + if (bsdf_node) { + bnode = bsdf_node->bnode(); + } + + /* If p-BSDF is not present, fallback to #Object.Material. */ + float roughness = material->roughness; + if (bnode) { + copy_property_from_node(SOCK_FLOAT, bnode, "Roughness", {&roughness, 1}); + } + /* Emperical approximation. Importer should use the inverse of this method. */ + float spec_exponent = (1.0f - roughness) * 30; + spec_exponent *= spec_exponent; + + float specular = material->spec; + if (bnode) { + copy_property_from_node(SOCK_FLOAT, bnode, "Specular", {&specular, 1}); + } + + float metallic = material->metallic; + if (bnode) { + copy_property_from_node(SOCK_FLOAT, bnode, "Metallic", {&metallic, 1}); + } + + float refraction_index = 1.0f; + if (bnode) { + copy_property_from_node(SOCK_FLOAT, bnode, "IOR", {&refraction_index, 1}); + } + + float dissolved = material->a; + if (bnode) { + copy_property_from_node(SOCK_FLOAT, bnode, "Alpha", {&dissolved, 1}); + } + const bool transparent = dissolved != 1.0f; + + float3 diffuse_col = {material->r, material->g, material->b}; + if (bnode) { + copy_property_from_node(SOCK_RGBA, bnode, "Base Color", {diffuse_col, 3}); + } + + float3 emission_col{0.0f}; + float emission_strength = 0.0f; + if (bnode) { + copy_property_from_node(SOCK_FLOAT, bnode, "Emission Strength", {&emission_strength, 1}); + copy_property_from_node(SOCK_RGBA, bnode, "Emission", {emission_col, 3}); + } + mul_v3_fl(emission_col, emission_strength); + + /* See https://wikipedia.org/wiki/Wavefront_.obj_file for all possible values of illum. */ + /* Highlight on. */ + int illum = 2; + if (specular == 0.0f) { + /* Color on and Ambient on. */ + illum = 1; + } + else if (metallic > 0.0f) { + /* Metallic ~= Reflection. */ + if (transparent) { + /* Transparency: Refraction on, Reflection: ~~Fresnel off and Ray trace~~ on. */ + illum = 6; + } + else { + /* Reflection on and Ray trace on. */ + illum = 3; + } + } + else if (transparent) { + /* Transparency: Glass on, Reflection: Ray trace off */ + illum = 9; + } + r_mtl_mat.Ns = spec_exponent; + if (metallic != 0.0f) { + r_mtl_mat.Ka = {metallic, metallic, metallic}; + } + else { + r_mtl_mat.Ka = {1.0f, 1.0f, 1.0f}; + } + r_mtl_mat.Kd = diffuse_col; + r_mtl_mat.Ks = {specular, specular, specular}; + r_mtl_mat.Ke = emission_col; + r_mtl_mat.Ni = refraction_index; + r_mtl_mat.d = dissolved; + r_mtl_mat.illum = illum; +} + +/** + * Store image texture options and filepaths in r_mtl_mat. + */ +static void store_image_textures(const nodes::NodeRef *bsdf_node, + const nodes::NodeTreeRef *node_tree, + const Material *material, + MTLMaterial &r_mtl_mat) +{ + if (!material || !node_tree || !bsdf_node) { + /* No nodetree, no images, or no Principled BSDF node. */ + return; + } + const bNode *bnode = bsdf_node->bnode(); + + /* Normal Map Texture has two extra tasks of: + * - finding a Normal Map node before finding a texture node. + * - finding "Strength" property of the node for `-bm` option. + */ + + for (Map<const eMTLSyntaxElement, tex_map_XX>::MutableItem texture_map : + r_mtl_mat.texture_maps.items()) { + Vector<const nodes::OutputSocketRef *> linked_sockets; + const bNode *normal_map_node{nullptr}; + + if (texture_map.key == eMTLSyntaxElement::map_Bump) { + /* Find sockets linked to destination "Normal" socket in p-bsdf node. */ + linked_sockets_to_dest_id(bnode, *node_tree, "Normal", linked_sockets); + /* Among the linked sockets, find Normal Map shader node. */ + normal_map_node = get_node_of_type(linked_sockets, SH_NODE_NORMAL_MAP); + + /* Find sockets linked to "Color" socket in normal map node. */ + linked_sockets_to_dest_id(normal_map_node, *node_tree, "Color", linked_sockets); + } + else if (texture_map.key == eMTLSyntaxElement::map_Ke) { + float emission_strength = 0.0f; + copy_property_from_node(SOCK_FLOAT, bnode, "Emission Strength", {&emission_strength, 1}); + if (emission_strength == 0.0f) { + continue; + } + } + else { + /* Find sockets linked to the destination socket of interest, in p-bsdf node. */ + linked_sockets_to_dest_id( + bnode, *node_tree, texture_map.value.dest_socket_id, linked_sockets); + } + + /* Among the linked sockets, find Image Texture shader node. */ + const bNode *tex_node{get_node_of_type(linked_sockets, SH_NODE_TEX_IMAGE)}; + if (!tex_node) { + continue; + } + const char *tex_image_filepath = get_image_filepath(tex_node); + if (!tex_image_filepath) { + continue; + } + + /* Find "Mapping" node if connected to texture node. */ + linked_sockets_to_dest_id(tex_node, *node_tree, "Vector", linked_sockets); + const bNode *mapping = get_node_of_type(linked_sockets, SH_NODE_MAPPING); + + if (normal_map_node) { + copy_property_from_node( + SOCK_FLOAT, normal_map_node, "Strength", {&r_mtl_mat.map_Bump_strength, 1}); + } + /* Texture transform options. Only translation (origin offset, "-o") and scale + * ("-o") are supported. */ + copy_property_from_node(SOCK_VECTOR, mapping, "Location", {texture_map.value.translation, 3}); + copy_property_from_node(SOCK_VECTOR, mapping, "Scale", {texture_map.value.scale, 3}); + + texture_map.value.image_path = tex_image_filepath; + } +} + +MTLMaterial mtlmaterial_for_material(const Material *material) +{ + BLI_assert(material != nullptr); + MTLMaterial mtlmat; + mtlmat.name = std::string(material->id.name + 2); + std::replace(mtlmat.name.begin(), mtlmat.name.end(), ' ', '_'); + const nodes::NodeTreeRef *nodetree = nullptr; + if (material->nodetree) { + nodetree = new nodes::NodeTreeRef(material->nodetree); + } + const nodes::NodeRef *bsdf_node = find_bsdf_node(nodetree); + store_bsdf_properties(bsdf_node, material, mtlmat); + store_image_textures(bsdf_node, nodetree, material, mtlmat); + if (nodetree) { + delete nodetree; + } + return mtlmat; +} + +} // namespace blender::io::obj diff --git a/source/blender/io/wavefront_obj/exporter/obj_export_mtl.hh b/source/blender/io/wavefront_obj/exporter/obj_export_mtl.hh new file mode 100644 index 00000000000..2f62d189bd1 --- /dev/null +++ b/source/blender/io/wavefront_obj/exporter/obj_export_mtl.hh @@ -0,0 +1,104 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/** \file + * \ingroup obj + */ + +#pragma once + +#include "BLI_float3.hh" +#include "BLI_map.hh" +#include "BLI_string_ref.hh" +#include "BLI_vector.hh" + +#include "DNA_node_types.h" +#include "obj_export_io.hh" + +namespace blender { +template<> struct DefaultHash<io::obj::eMTLSyntaxElement> { + uint64_t operator()(const io::obj::eMTLSyntaxElement value) const + { + return static_cast<uint64_t>(value); + } +}; + +} // namespace blender + +namespace blender::io::obj { +class OBJMesh; + +/** + * Generic container for texture node properties. + */ +struct tex_map_XX { + tex_map_XX(StringRef to_socket_id) : dest_socket_id(to_socket_id){}; + + /** Target socket which this texture node connects to. */ + const std::string dest_socket_id; + float3 translation{0.0f}; + float3 scale{1.0f}; + /* Only Flat and Smooth projections are supported. */ + int projection_type = SHD_PROJ_FLAT; + std::string image_path; + std::string mtl_dir_path; +}; + +/** + * Container suited for storing Material data for/from a .MTL file. + */ +struct MTLMaterial { + MTLMaterial() + { + texture_maps.add(eMTLSyntaxElement::map_Kd, tex_map_XX("Base Color")); + texture_maps.add(eMTLSyntaxElement::map_Ks, tex_map_XX("Specular")); + texture_maps.add(eMTLSyntaxElement::map_Ns, tex_map_XX("Roughness")); + texture_maps.add(eMTLSyntaxElement::map_d, tex_map_XX("Alpha")); + texture_maps.add(eMTLSyntaxElement::map_refl, tex_map_XX("Metallic")); + texture_maps.add(eMTLSyntaxElement::map_Ke, tex_map_XX("Emission")); + texture_maps.add(eMTLSyntaxElement::map_Bump, tex_map_XX("Normal")); + } + + /** + * Caller must ensure that the given lookup key exists in the Map. + * \return Texture map corresponding to the given ID. + */ + tex_map_XX &tex_map_of_type(const eMTLSyntaxElement key) + { + { + BLI_assert(texture_maps.contains_as(key)); + return texture_maps.lookup_as(key); + } + } + + std::string name; + /* Always check for negative values while importing or exporting. Use defaults if + * any value is negative. */ + float Ns{-1.0f}; + float3 Ka{-1.0f}; + float3 Kd{-1.0f}; + float3 Ks{-1.0f}; + float3 Ke{-1.0f}; + float Ni{-1.0f}; + float d{-1.0f}; + int illum{-1}; + Map<const eMTLSyntaxElement, tex_map_XX> texture_maps; + /** Only used for Normal Map node: "map_Bump". */ + float map_Bump_strength{-1.0f}; +}; + +MTLMaterial mtlmaterial_for_material(const Material *material); +} // namespace blender::io::obj diff --git a/source/blender/io/wavefront_obj/exporter/obj_export_nurbs.cc b/source/blender/io/wavefront_obj/exporter/obj_export_nurbs.cc new file mode 100644 index 00000000000..4138ad2f697 --- /dev/null +++ b/source/blender/io/wavefront_obj/exporter/obj_export_nurbs.cc @@ -0,0 +1,122 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/** \file + * \ingroup obj + */ + +#include "BLI_float3.hh" +#include "BLI_listbase.h" +#include "BLI_math.h" + +#include "DEG_depsgraph.h" +#include "DEG_depsgraph_query.h" + +#include "IO_wavefront_obj.h" +#include "obj_export_nurbs.hh" + +namespace blender::io::obj { +OBJCurve::OBJCurve(const Depsgraph *depsgraph, + const OBJExportParams &export_params, + Object *curve_object) + : export_object_eval_(curve_object) +{ + export_object_eval_ = DEG_get_evaluated_object(depsgraph, curve_object); + export_curve_ = static_cast<Curve *>(export_object_eval_->data); + set_world_axes_transform(export_params.forward_axis, export_params.up_axis); +} + +/** + * Set the final transform after applying axes settings and an Object's world transform. + */ +void OBJCurve::set_world_axes_transform(const eTransformAxisForward forward, + const eTransformAxisUp up) +{ + float axes_transform[3][3]; + unit_m3(axes_transform); + /* +Y-forward and +Z-up are the Blender's default axis settings. */ + mat3_from_axis_conversion(OBJ_AXIS_Y_FORWARD, OBJ_AXIS_Z_UP, forward, up, axes_transform); + /* mat3_from_axis_conversion returns a transposed matrix! */ + transpose_m3(axes_transform); + mul_m4_m3m4(world_axes_transform_, axes_transform, export_object_eval_->obmat); + /* #mul_m4_m3m4 does not transform last row of #Object.obmat, i.e. location data. */ + mul_v3_m3v3(world_axes_transform_[3], axes_transform, export_object_eval_->obmat[3]); + world_axes_transform_[3][3] = export_object_eval_->obmat[3][3]; +} + +const char *OBJCurve::get_curve_name() const +{ + return export_object_eval_->id.name + 2; +} + +int OBJCurve::total_splines() const +{ + return BLI_listbase_count(&export_curve_->nurb); +} + +/** + * \param spline_index: Zero-based index of spline of interest. + * \return: Total vertices in a spline. + */ +int OBJCurve::total_spline_vertices(const int spline_index) const +{ + const Nurb *const nurb = static_cast<Nurb *>(BLI_findlink(&export_curve_->nurb, spline_index)); + return nurb->pntsu * nurb->pntsv; +} + +/** + * Get coordinates of the vertex at the given index on the given spline. + */ +float3 OBJCurve::vertex_coordinates(const int spline_index, + const int vertex_index, + const float scaling_factor) const +{ + const Nurb *const nurb = static_cast<Nurb *>(BLI_findlink(&export_curve_->nurb, spline_index)); + float3 r_coord; + const BPoint &bpoint = nurb->bp[vertex_index]; + copy_v3_v3(r_coord, bpoint.vec); + mul_m4_v3(world_axes_transform_, r_coord); + mul_v3_fl(r_coord, scaling_factor); + return r_coord; +} + +/** + * Get total control points of the NURBS spline at the given index. This is different than total + * vertices of a spline. + */ +int OBJCurve::total_spline_control_points(const int spline_index) const +{ + const Nurb *const nurb = static_cast<Nurb *>(BLI_findlink(&export_curve_->nurb, spline_index)); + const int r_nurbs_degree = nurb->orderu - 1; + /* Total control points = Number of points in the curve (+ degree of the + * curve if it is cyclic). */ + int r_tot_control_points = nurb->pntsv * nurb->pntsu; + if (nurb->flagu & CU_NURB_CYCLIC) { + r_tot_control_points += r_nurbs_degree; + } + return r_tot_control_points; +} + +/** + * Get the degree of the NURBS spline at the given index. + */ +int OBJCurve::get_nurbs_degree(const int spline_index) const +{ + const Nurb *const nurb = static_cast<Nurb *>(BLI_findlink(&export_curve_->nurb, spline_index)); + return nurb->orderu - 1; +} + +} // namespace blender::io::obj diff --git a/source/blender/io/wavefront_obj/exporter/obj_export_nurbs.hh b/source/blender/io/wavefront_obj/exporter/obj_export_nurbs.hh new file mode 100644 index 00000000000..463e41befb5 --- /dev/null +++ b/source/blender/io/wavefront_obj/exporter/obj_export_nurbs.hh @@ -0,0 +1,57 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/** \file + * \ingroup obj + */ + +#pragma once + +#include "BLI_utility_mixins.hh" + +#include "DNA_curve_types.h" + +namespace blender::io::obj { + +/** + * Provides access to the a Curve Object's properties. + * Only #CU_NURBS type is supported. + * + * \note Used for Curves to be exported in parameter form, and not converted to meshes. + */ +class OBJCurve : NonCopyable { + private: + const Object *export_object_eval_; + const Curve *export_curve_; + float world_axes_transform_[4][4]; + + public: + OBJCurve(const Depsgraph *depsgraph, const OBJExportParams &export_params, Object *curve_object); + + const char *get_curve_name() const; + int total_splines() const; + int total_spline_vertices(const int spline_index) const; + float3 vertex_coordinates(const int spline_index, + const int vertex_index, + const float scaling_factor) const; + int total_spline_control_points(const int spline_index) const; + int get_nurbs_degree(const int spline_index) const; + + private: + void set_world_axes_transform(const eTransformAxisForward forward, const eTransformAxisUp up); +}; + +} // namespace blender::io::obj diff --git a/source/blender/io/wavefront_obj/exporter/obj_exporter.cc b/source/blender/io/wavefront_obj/exporter/obj_exporter.cc new file mode 100644 index 00000000000..d15d053adc9 --- /dev/null +++ b/source/blender/io/wavefront_obj/exporter/obj_exporter.cc @@ -0,0 +1,302 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/** \file + * \ingroup obj + */ + +#include <cstdio> +#include <exception> +#include <memory> + +#include "BKE_scene.h" + +#include "BLI_path_util.h" +#include "BLI_vector.hh" + +#include "DEG_depsgraph_query.h" + +#include "DNA_scene_types.h" + +#include "ED_object.h" + +#include "obj_export_mesh.hh" +#include "obj_export_nurbs.hh" +#include "obj_exporter.hh" + +#include "obj_export_file_writer.hh" + +namespace blender::io::obj { + +OBJDepsgraph::OBJDepsgraph(const bContext *C, const eEvaluationMode eval_mode) +{ + Scene *scene = CTX_data_scene(C); + Main *bmain = CTX_data_main(C); + ViewLayer *view_layer = CTX_data_view_layer(C); + if (eval_mode == DAG_EVAL_RENDER) { + depsgraph_ = DEG_graph_new(bmain, scene, view_layer, DAG_EVAL_RENDER); + needs_free_ = true; + DEG_graph_build_for_all_objects(depsgraph_); + BKE_scene_graph_evaluated_ensure(depsgraph_, bmain); + } + else { + depsgraph_ = CTX_data_ensure_evaluated_depsgraph(C); + needs_free_ = false; + } +} + +OBJDepsgraph::~OBJDepsgraph() +{ + if (needs_free_) { + DEG_graph_free(depsgraph_); + } +} + +Depsgraph *OBJDepsgraph::get() +{ + return depsgraph_; +} + +void OBJDepsgraph::update_for_newframe() +{ + BKE_scene_graph_update_for_newframe(depsgraph_); +} + +static void print_exception_error(const std::system_error &ex) +{ + std::cerr << ex.code().category().name() << ": " << ex.what() << ": " << ex.code().message() + << std::endl; +} + +/** + * Filter supported objects from the Scene. + * + * \note Curves are also stored with Meshes if export settings specify so. + */ +std::pair<Vector<std::unique_ptr<OBJMesh>>, Vector<std::unique_ptr<OBJCurve>>> +filter_supported_objects(Depsgraph *depsgraph, const OBJExportParams &export_params) +{ + Vector<std::unique_ptr<OBJMesh>> r_exportable_meshes; + Vector<std::unique_ptr<OBJCurve>> r_exportable_nurbs; + const ViewLayer *view_layer = DEG_get_input_view_layer(depsgraph); + LISTBASE_FOREACH (const Base *, base, &view_layer->object_bases) { + Object *object_in_layer = base->object; + if (export_params.export_selected_objects && !(object_in_layer->base_flag & BASE_SELECTED)) { + continue; + } + switch (object_in_layer->type) { + case OB_SURF: + /* Export in mesh form: vertices and polygons. */ + ATTR_FALLTHROUGH; + case OB_MESH: + r_exportable_meshes.append( + std::make_unique<OBJMesh>(depsgraph, export_params, object_in_layer)); + break; + case OB_CURVE: { + Curve *curve = static_cast<Curve *>(object_in_layer->data); + Nurb *nurb{static_cast<Nurb *>(curve->nurb.first)}; + if (!nurb) { + /* An empty curve. Not yet supported to export these as meshes. */ + if (export_params.export_curves_as_nurbs) { + r_exportable_nurbs.append( + std::make_unique<OBJCurve>(depsgraph, export_params, object_in_layer)); + } + break; + } + switch (nurb->type) { + case CU_NURBS: + if (export_params.export_curves_as_nurbs) { + /* Export in parameter form: control points. */ + r_exportable_nurbs.append( + std::make_unique<OBJCurve>(depsgraph, export_params, object_in_layer)); + } + else { + /* Export in mesh form: edges and vertices. */ + r_exportable_meshes.append( + std::make_unique<OBJMesh>(depsgraph, export_params, object_in_layer)); + } + break; + case CU_BEZIER: + /* Always export in mesh form: edges and vertices. */ + r_exportable_meshes.append( + std::make_unique<OBJMesh>(depsgraph, export_params, object_in_layer)); + break; + default: + /* Other curve types are not supported. */ + break; + } + break; + } + default: + /* Other object types are not supported. */ + break; + } + } + return {std::move(r_exportable_meshes), std::move(r_exportable_nurbs)}; +} + +static void write_mesh_objects(Vector<std::unique_ptr<OBJMesh>> exportable_as_mesh, + OBJWriter &obj_writer, + MTLWriter *mtl_writer, + const OBJExportParams &export_params) +{ + if (mtl_writer) { + obj_writer.write_mtllib_name(mtl_writer->mtl_file_path()); + } + + /* Smooth groups and UV vertex indices may make huge memory allocations, so they should be freed + * right after they're written, instead of waiting for #blender::Vector to clean them up after + * all the objects are exported. */ + for (auto &obj_mesh : exportable_as_mesh) { + obj_writer.write_object_name(*obj_mesh); + obj_writer.write_vertex_coords(*obj_mesh); + Vector<int> obj_mtlindices; + + if (obj_mesh->tot_polygons() > 0) { + if (export_params.export_smooth_groups) { + obj_mesh->calc_smooth_groups(export_params.smooth_groups_bitflags); + } + if (export_params.export_normals) { + obj_writer.write_poly_normals(*obj_mesh); + } + if (export_params.export_uv) { + obj_writer.write_uv_coords(*obj_mesh); + } + if (mtl_writer) { + obj_mtlindices = mtl_writer->add_materials(*obj_mesh); + } + /* This function takes a 0-indexed slot index for the obj_mesh object and + * returns the material name that we are using in the .obj file for it. */ + std::function<const char *(int)> matname_fn = [&](int s) -> const char * { + if (!mtl_writer || s < 0 || s >= obj_mtlindices.size()) { + return nullptr; + } + return mtl_writer->mtlmaterial_name(obj_mtlindices[s]); + }; + obj_writer.write_poly_elements(*obj_mesh, matname_fn); + } + obj_writer.write_edges_indices(*obj_mesh); + + obj_writer.update_index_offsets(*obj_mesh); + } +} + +/** + * Export NURBS Curves in parameter form, not as vertices and edges. + */ +static void write_nurbs_curve_objects(const Vector<std::unique_ptr<OBJCurve>> &exportable_as_nurbs, + const OBJWriter &obj_writer) +{ + /* #OBJCurve doesn't have any dynamically allocated memory, so it's fine + * to wait for #blender::Vector to clean the objects up. */ + for (const std::unique_ptr<OBJCurve> &obj_curve : exportable_as_nurbs) { + obj_writer.write_nurbs_curve(*obj_curve); + } +} + +/** + * Export a single frame to a .OBJ file. + * + * Conditionally write a .MTL file also. + */ +void export_frame(Depsgraph *depsgraph, const OBJExportParams &export_params, const char *filepath) +{ + std::unique_ptr<OBJWriter> frame_writer = nullptr; + try { + frame_writer = std::make_unique<OBJWriter>(filepath, export_params); + } + catch (const std::system_error &ex) { + print_exception_error(ex); + return; + } + if (!frame_writer) { + BLI_assert(!"File should be writable by now."); + return; + } + std::unique_ptr<MTLWriter> mtl_writer = nullptr; + if (export_params.export_materials) { + try { + mtl_writer = std::make_unique<MTLWriter>(export_params.filepath); + } + catch (const std::system_error &ex) { + print_exception_error(ex); + } + } + + frame_writer->write_header(); + + auto [exportable_as_mesh, exportable_as_nurbs] = filter_supported_objects(depsgraph, + export_params); + + write_mesh_objects( + std::move(exportable_as_mesh), *frame_writer, mtl_writer.get(), export_params); + if (mtl_writer) { + mtl_writer->write_header(export_params.blen_filepath); + mtl_writer->write_materials(); + } + write_nurbs_curve_objects(std::move(exportable_as_nurbs), *frame_writer); +} + +/** + * Append the current frame number in the .OBJ file name. + * + * \return Whether the filepath is in #FILE_MAX limits. + */ +bool append_frame_to_filename(const char *filepath, const int frame, char *r_filepath_with_frames) +{ + BLI_strncpy(r_filepath_with_frames, filepath, FILE_MAX); + BLI_path_extension_replace(r_filepath_with_frames, FILE_MAX, ""); + const int digits = frame == 0 ? 1 : integer_digits_i(abs(frame)); + BLI_path_frame(r_filepath_with_frames, frame, digits); + return BLI_path_extension_replace(r_filepath_with_frames, FILE_MAX, ".obj"); +} + +/** + * Central internal function to call Scene update & writer functions. + */ +void exporter_main(bContext *C, const OBJExportParams &export_params) +{ + ED_object_mode_set(C, OB_MODE_OBJECT); + OBJDepsgraph obj_depsgraph(C, export_params.export_eval_mode); + Scene *scene = DEG_get_input_scene(obj_depsgraph.get()); + const char *filepath = export_params.filepath; + + /* Single frame export, i.e. no animation. */ + if (!export_params.export_animation) { + fprintf(stderr, "Writing to %s\n", filepath); + export_frame(obj_depsgraph.get(), export_params, filepath); + return; + } + + char filepath_with_frames[FILE_MAX]; + /* Used to reset the Scene to its original state. */ + const int original_frame = CFRA; + + for (int frame = export_params.start_frame; frame <= export_params.end_frame; frame++) { + const bool filepath_ok = append_frame_to_filename(filepath, frame, filepath_with_frames); + if (!filepath_ok) { + fprintf(stderr, "Error: File Path too long.\n%s\n", filepath_with_frames); + return; + } + + CFRA = frame; + obj_depsgraph.update_for_newframe(); + fprintf(stderr, "Writing to %s\n", filepath_with_frames); + export_frame(obj_depsgraph.get(), export_params, filepath_with_frames); + } + CFRA = original_frame; +} +} // namespace blender::io::obj diff --git a/source/blender/io/wavefront_obj/exporter/obj_exporter.hh b/source/blender/io/wavefront_obj/exporter/obj_exporter.hh new file mode 100644 index 00000000000..e02a240b51a --- /dev/null +++ b/source/blender/io/wavefront_obj/exporter/obj_exporter.hh @@ -0,0 +1,88 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/** \file + * \ingroup obj + */ + +#pragma once + +#include "BLI_utility_mixins.hh" + +#include "BLI_vector.hh" + +#include "IO_wavefront_obj.h" + +namespace blender::io::obj { + +/** + * Behaves like `std::unique_ptr<Depsgraph, custom_deleter>`. + * Needed to free a new Depsgraph created for #DAG_EVAL_RENDER. + */ +class OBJDepsgraph : NonMovable, NonCopyable { + private: + Depsgraph *depsgraph_ = nullptr; + bool needs_free_ = false; + + public: + OBJDepsgraph(const bContext *C, const eEvaluationMode eval_mode); + ~OBJDepsgraph(); + + Depsgraph *get(); + void update_for_newframe(); +}; + +/** + * The main function for exporting a .obj file according to the given `export_parameters`. + * It uses the context `C` to get the dependency graph, and from that, the `Scene`. + * Depending on whether or not `export_params.export_animation` is set, it writes + * either one file per animation frame, or just one file. + */ +void exporter_main(bContext *C, const OBJExportParams &export_params); + +class OBJMesh; +class OBJCurve; + +/** + * Export a single frame of a .obj file, according to the given `export_parameters`. + * The frame state is given in `depsgraph`. + * The output file name is given by `filepath`. + * This function is normally called from `exporter_main`, but is exposed here for testing purposes. + */ +void export_frame(Depsgraph *depsgraph, + const OBJExportParams &export_params, + const char *filepath); + +/** + * Find the objects to be exported in the `view_layer` of the dependency graph`depsgraph`, + * and return them in vectors `unique_ptr`s of `OBJMesh` and `OBJCurve`. + * If `export_params.export_selected_objects` is set, then only selected objects are to be + * exported, else all objects are to be exported. But only objects of type `OB_MESH`, `OB_CURVE`, + * and `OB_SURF` are supported; the rest will be ignored. If `export_params.export_curves_as_nurbs` + * is set, then curves of type `CU_NURBS` are exported in curve form in the .obj file, otherwise + * they are converted to mesh and returned in the `OBJMesh` vector. All other exportable types are + * always converted to mesh and returned in the `OBJMesh` vector. + */ +std::pair<Vector<std::unique_ptr<OBJMesh>>, Vector<std::unique_ptr<OBJCurve>>> +filter_supported_objects(Depsgraph *depsgraph, const OBJExportParams &export_params); + +/** + * Makes `r_filepath_with_frames` (which should point at a character array of size `FILE_MAX`) + * be `filepath` with its "#" characters replaced by the number representing `frame`, and with + * a .obj extension. + */ +bool append_frame_to_filename(const char *filepath, const int frame, char *r_filepath_with_frames); +} // namespace blender::io::obj diff --git a/source/blender/io/wavefront_obj/tests/obj_exporter_tests.cc b/source/blender/io/wavefront_obj/tests/obj_exporter_tests.cc new file mode 100644 index 00000000000..f12bfd0cea5 --- /dev/null +++ b/source/blender/io/wavefront_obj/tests/obj_exporter_tests.cc @@ -0,0 +1,417 @@ +/* Apache License, Version 2.0 */ + +#include <fstream> +#include <gtest/gtest.h> +#include <ios> +#include <memory> +#include <sstream> +#include <string> +#include <system_error> + +#include "testing/testing.h" +#include "tests/blendfile_loading_base_test.h" + +#include "BKE_appdir.h" +#include "BKE_blender_version.h" + +#include "BLI_fileops.h" +#include "BLI_index_range.hh" +#include "BLI_string_utf8.h" +#include "BLI_vector.hh" + +#include "DEG_depsgraph.h" + +#include "obj_export_file_writer.hh" +#include "obj_export_mesh.hh" +#include "obj_export_nurbs.hh" +#include "obj_exporter.hh" + +#include "obj_exporter_tests.hh" + +namespace blender::io::obj { + +/* This is also the test name. */ +class obj_exporter_test : public BlendfileLoadingBaseTest { + public: + /** + * \param filepath: relative to "tests" directory. + */ + bool load_file_and_depsgraph(const std::string &filepath, + const eEvaluationMode eval_mode = DAG_EVAL_VIEWPORT) + { + if (!blendfile_load(filepath.c_str())) { + return false; + } + depsgraph_create(eval_mode); + return true; + } +}; + +const std::string all_objects_file = "io_tests/blend_scene/all_objects.blend"; +const std::string all_curve_objects_file = "io_tests/blend_scene/all_curves.blend"; + +TEST_F(obj_exporter_test, filter_objects_curves_as_mesh) +{ + OBJExportParamsDefault _export; + if (!load_file_and_depsgraph(all_objects_file)) { + ADD_FAILURE(); + return; + } + auto [objmeshes, objcurves]{filter_supported_objects(depsgraph, _export.params)}; + EXPECT_EQ(objmeshes.size(), 17); + EXPECT_EQ(objcurves.size(), 0); +} + +TEST_F(obj_exporter_test, filter_objects_curves_as_nurbs) +{ + OBJExportParamsDefault _export; + if (!load_file_and_depsgraph(all_objects_file)) { + ADD_FAILURE(); + return; + } + _export.params.export_curves_as_nurbs = true; + auto [objmeshes, objcurves]{filter_supported_objects(depsgraph, _export.params)}; + EXPECT_EQ(objmeshes.size(), 16); + EXPECT_EQ(objcurves.size(), 2); +} + +TEST_F(obj_exporter_test, filter_objects_selected) +{ + OBJExportParamsDefault _export; + if (!load_file_and_depsgraph(all_objects_file)) { + ADD_FAILURE(); + return; + } + _export.params.export_selected_objects = true; + _export.params.export_curves_as_nurbs = true; + auto [objmeshes, objcurves]{filter_supported_objects(depsgraph, _export.params)}; + EXPECT_EQ(objmeshes.size(), 1); + EXPECT_EQ(objcurves.size(), 0); +} + +TEST(obj_exporter_utils, append_negative_frame_to_filename) +{ + const char path_original[FILE_MAX] = "/my_file.obj"; + const char path_truth[FILE_MAX] = "/my_file-123.obj"; + const int frame = -123; + char path_with_frame[FILE_MAX] = {0}; + const bool ok = append_frame_to_filename(path_original, frame, path_with_frame); + EXPECT_TRUE(ok); + EXPECT_EQ_ARRAY(path_with_frame, path_truth, BLI_strlen_utf8(path_truth)); +} + +TEST(obj_exporter_utils, append_positive_frame_to_filename) +{ + const char path_original[FILE_MAX] = "/my_file.obj"; + const char path_truth[FILE_MAX] = "/my_file123.obj"; + const int frame = 123; + char path_with_frame[FILE_MAX] = {0}; + const bool ok = append_frame_to_filename(path_original, frame, path_with_frame); + EXPECT_TRUE(ok); + EXPECT_EQ_ARRAY(path_with_frame, path_truth, BLI_strlen_utf8(path_truth)); +} + +TEST_F(obj_exporter_test, curve_nurbs_points) +{ + if (!load_file_and_depsgraph(all_curve_objects_file)) { + ADD_FAILURE(); + return; + } + + OBJExportParamsDefault _export; + _export.params.export_curves_as_nurbs = true; + auto [objmeshes_unused, objcurves]{filter_supported_objects(depsgraph, _export.params)}; + + for (auto &objcurve : objcurves) { + if (all_nurbs_truth.count(objcurve->get_curve_name()) != 1) { + ADD_FAILURE(); + return; + } + const NurbsObject *const nurbs_truth = all_nurbs_truth.at(objcurve->get_curve_name()).get(); + EXPECT_EQ(objcurve->total_splines(), nurbs_truth->total_splines()); + for (int spline_index : IndexRange(objcurve->total_splines())) { + EXPECT_EQ(objcurve->total_spline_vertices(spline_index), + nurbs_truth->total_spline_vertices(spline_index)); + EXPECT_EQ(objcurve->get_nurbs_degree(spline_index), + nurbs_truth->get_nurbs_degree(spline_index)); + EXPECT_EQ(objcurve->total_spline_control_points(spline_index), + nurbs_truth->total_spline_control_points(spline_index)); + } + } +} + +TEST_F(obj_exporter_test, curve_coordinates) +{ + if (!load_file_and_depsgraph(all_curve_objects_file)) { + ADD_FAILURE(); + return; + } + + OBJExportParamsDefault _export; + _export.params.export_curves_as_nurbs = true; + auto [objmeshes_unused, objcurves]{filter_supported_objects(depsgraph, _export.params)}; + + for (auto &objcurve : objcurves) { + if (all_nurbs_truth.count(objcurve->get_curve_name()) != 1) { + ADD_FAILURE(); + return; + } + const NurbsObject *const nurbs_truth = all_nurbs_truth.at(objcurve->get_curve_name()).get(); + EXPECT_EQ(objcurve->total_splines(), nurbs_truth->total_splines()); + for (int spline_index : IndexRange(objcurve->total_splines())) { + for (int vertex_index : IndexRange(objcurve->total_spline_vertices(spline_index))) { + EXPECT_V3_NEAR(objcurve->vertex_coordinates( + spline_index, vertex_index, _export.params.scaling_factor), + nurbs_truth->vertex_coordinates(spline_index, vertex_index), + 0.000001f); + } + } + } +} + +static std::unique_ptr<OBJWriter> init_writer(const OBJExportParams ¶ms, + const std::string out_filepath) +{ + try { + auto writer = std::make_unique<OBJWriter>(out_filepath.c_str(), params); + return writer; + } + catch (const std::system_error &ex) { + std::cerr << ex.code().category().name() << ": " << ex.what() << ": " << ex.code().message() + << std::endl; + return nullptr; + } +} + +/* The following is relative to BKE_tempdir_base. */ +const char *const temp_file_path = "output.OBJ"; + +static std::string read_temp_file_in_string(const std::string &file_path) +{ + std::ifstream temp_stream(file_path); + std::ostringstream input_ss; + input_ss << temp_stream.rdbuf(); + return input_ss.str(); +} + +TEST(obj_exporter_writer, header) +{ + /* Because testing doesn't fully initialize Blender, we need the following. */ + BKE_tempdir_init(NULL); + std::string out_file_path = blender::tests::flags_test_release_dir() + "/" + temp_file_path; + { + OBJExportParamsDefault _export; + std::unique_ptr<OBJWriter> writer = init_writer(_export.params, out_file_path); + if (!writer) { + ADD_FAILURE(); + return; + } + writer->write_header(); + } + const std::string result = read_temp_file_in_string(out_file_path); + using namespace std::string_literals; + ASSERT_EQ(result, "# Blender "s + BKE_blender_version_string() + "\n" + "# www.blender.org\n"); + BLI_delete(out_file_path.c_str(), false, false); +} + +TEST(obj_exporter_writer, mtllib) +{ + std::string out_file_path = blender::tests::flags_test_release_dir() + "/" + temp_file_path; + { + OBJExportParamsDefault _export; + std::unique_ptr<OBJWriter> writer = init_writer(_export.params, out_file_path); + if (!writer) { + ADD_FAILURE(); + return; + } + writer->write_mtllib_name("/Users/blah.mtl"); + writer->write_mtllib_name("\\C:\\blah.mtl"); + } + const std::string result = read_temp_file_in_string(out_file_path); + ASSERT_EQ(result, "mtllib blah.mtl\nmtllib blah.mtl\n"); +} + +/* Return true if string #a and string #b are equal after their first newline. */ +static bool strings_equal_after_first_lines(const std::string &a, const std::string &b) +{ + /* If `dbg_level > 0` then a failing test will print context around the first mismatch. */ + const bool dbg_level = 0; + const size_t a_len = a.size(); + const size_t b_len = b.size(); + const size_t a_next = a.find_first_of('\n'); + const size_t b_next = b.find_first_of('\n'); + if (a_next == std::string::npos || b_next == std::string::npos) { + if (dbg_level > 0) { + std::cout << "Couldn't find newline in one of args\n"; + } + return false; + } + if (dbg_level > 0) { + if (a.compare(a_next, a_len - a_next, b, b_next, b_len - b_next) != 0) { + for (int i = 0; i < a_len - a_next && i < b_len - b_next; ++i) { + if (a[a_next + i] != b[b_next + i]) { + std::cout << "Difference found at pos " << a_next + i << " of a\n"; + std::cout << "a: " << a.substr(a_next + i, 100) << " ...\n"; + std::cout << "b: " << b.substr(b_next + i, 100) << " ... \n"; + return false; + } + } + } + else { + return true; + } + } + return a.compare(a_next, a_len - a_next, b, b_next, b_len - b_next) == 0; +} + +/* From here on, tests are whole file tests, testing for golden output. */ +class obj_exporter_regression_test : public obj_exporter_test { + public: + /** + * Export the given blend file with the given parameters and + * test to see if it matches a golden file (ignoring any difference in Blender version number). + * \param blendfile: input, relative to "tests" directory. + * \param golden_obj: expected output, relative to "tests" directory. + * \param params: the parameters to be used for export. + */ + void compare_obj_export_to_golden(const std::string &blendfile, + const std::string &golden_obj, + const std::string &golden_mtl, + OBJExportParams ¶ms) + { + if (!load_file_and_depsgraph(blendfile)) { + return; + } + /* Because testing doesn't fully initialize Blender, we need the following. */ + BKE_tempdir_init(NULL); + std::string tempdir = std::string(BKE_tempdir_base()); + std::string out_file_path = tempdir + BLI_path_basename(golden_obj.c_str()); + strncpy(params.filepath, out_file_path.c_str(), FILE_MAX); + params.blen_filepath = blendfile.c_str(); + export_frame(depsgraph, params, out_file_path.c_str()); + std::string output_str = read_temp_file_in_string(out_file_path); + + std::string golden_file_path = blender::tests::flags_test_asset_dir() + "/" + golden_obj; + std::string golden_str = read_temp_file_in_string(golden_file_path); + ASSERT_TRUE(strings_equal_after_first_lines(output_str, golden_str)); + BLI_delete(out_file_path.c_str(), false, false); + if (!golden_mtl.empty()) { + std::string out_mtl_file_path = tempdir + BLI_path_basename(golden_mtl.c_str()); + std::string output_mtl_str = read_temp_file_in_string(out_mtl_file_path); + std::string golden_mtl_file_path = blender::tests::flags_test_asset_dir() + "/" + golden_mtl; + std::string golden_mtl_str = read_temp_file_in_string(golden_mtl_file_path); + ASSERT_TRUE(strings_equal_after_first_lines(output_mtl_str, golden_mtl_str)); + BLI_delete(out_mtl_file_path.c_str(), false, false); + } + } +}; + +TEST_F(obj_exporter_regression_test, all_tris) +{ + OBJExportParamsDefault _export; + compare_obj_export_to_golden("io_tests/blend_geometry/all_tris.blend", + "io_tests/obj/all_tris.obj", + "io_tests/obj/all_tris.mtl", + _export.params); +} + +TEST_F(obj_exporter_regression_test, all_quads) +{ + OBJExportParamsDefault _export; + _export.params.scaling_factor = 2.0f; + _export.params.export_materials = false; + compare_obj_export_to_golden( + "io_tests/blend_geometry/all_quads.blend", "io_tests/obj/all_quads.obj", "", _export.params); +} + +TEST_F(obj_exporter_regression_test, fgons) +{ + OBJExportParamsDefault _export; + _export.params.forward_axis = OBJ_AXIS_Y_FORWARD; + _export.params.up_axis = OBJ_AXIS_Z_UP; + _export.params.export_materials = false; + compare_obj_export_to_golden( + "io_tests/blend_geometry/fgons.blend", "io_tests/obj/fgons.obj", "", _export.params); +} + +TEST_F(obj_exporter_regression_test, edges) +{ + OBJExportParamsDefault _export; + _export.params.forward_axis = OBJ_AXIS_Y_FORWARD; + _export.params.up_axis = OBJ_AXIS_Z_UP; + _export.params.export_materials = false; + compare_obj_export_to_golden( + "io_tests/blend_geometry/edges.blend", "io_tests/obj/edges.obj", "", _export.params); +} + +TEST_F(obj_exporter_regression_test, vertices) +{ + OBJExportParamsDefault _export; + _export.params.forward_axis = OBJ_AXIS_Y_FORWARD; + _export.params.up_axis = OBJ_AXIS_Z_UP; + _export.params.export_materials = false; + compare_obj_export_to_golden( + "io_tests/blend_geometry/vertices.blend", "io_tests/obj/vertices.obj", "", _export.params); +} + +TEST_F(obj_exporter_regression_test, nurbs_as_nurbs) +{ + OBJExportParamsDefault _export; + _export.params.forward_axis = OBJ_AXIS_Y_FORWARD; + _export.params.up_axis = OBJ_AXIS_Z_UP; + _export.params.export_materials = false; + _export.params.export_curves_as_nurbs = true; + compare_obj_export_to_golden( + "io_tests/blend_geometry/nurbs.blend", "io_tests/obj/nurbs.obj", "", _export.params); +} + +TEST_F(obj_exporter_regression_test, nurbs_as_mesh) +{ + OBJExportParamsDefault _export; + _export.params.forward_axis = OBJ_AXIS_Y_FORWARD; + _export.params.up_axis = OBJ_AXIS_Z_UP; + _export.params.export_materials = false; + _export.params.export_curves_as_nurbs = false; + compare_obj_export_to_golden( + "io_tests/blend_geometry/nurbs.blend", "io_tests/obj/nurbs_mesh.obj", "", _export.params); +} + +TEST_F(obj_exporter_regression_test, cube_all_data_triangulated) +{ + OBJExportParamsDefault _export; + _export.params.forward_axis = OBJ_AXIS_Y_FORWARD; + _export.params.up_axis = OBJ_AXIS_Z_UP; + _export.params.export_materials = false; + _export.params.export_triangulated_mesh = true; + compare_obj_export_to_golden("io_tests/blend_geometry/cube_all_data.blend", + "io_tests/obj/cube_all_data_triangulated.obj", + "", + _export.params); +} + +TEST_F(obj_exporter_regression_test, suzanne_all_data) +{ + OBJExportParamsDefault _export; + _export.params.forward_axis = OBJ_AXIS_Y_FORWARD; + _export.params.up_axis = OBJ_AXIS_Z_UP; + _export.params.export_materials = false; + _export.params.export_smooth_groups = true; + compare_obj_export_to_golden("io_tests/blend_geometry/suzanne_all_data.blend", + "io_tests/obj/suzanne_all_data.obj", + "", + _export.params); +} + +TEST_F(obj_exporter_regression_test, all_objects) +{ + OBJExportParamsDefault _export; + _export.params.forward_axis = OBJ_AXIS_Y_FORWARD; + _export.params.up_axis = OBJ_AXIS_Z_UP; + _export.params.export_smooth_groups = true; + compare_obj_export_to_golden("io_tests/blend_scene/all_objects.blend", + "io_tests/obj/all_objects.obj", + "io_tests/obj/all_objects.mtl", + _export.params); +} + +} // namespace blender::io::obj diff --git a/source/blender/io/wavefront_obj/tests/obj_exporter_tests.hh b/source/blender/io/wavefront_obj/tests/obj_exporter_tests.hh new file mode 100644 index 00000000000..def70eff0ee --- /dev/null +++ b/source/blender/io/wavefront_obj/tests/obj_exporter_tests.hh @@ -0,0 +1,149 @@ +/* Apache License, Version 2.0 */ + +/** + * This file contains default values for several items like + * vertex coordinates, export parameters, MTL values etc. + */ + +#pragma once + +#include <array> +#include <gtest/gtest.h> +#include <string> +#include <vector> + +#include "IO_wavefront_obj.h" + +namespace blender::io::obj { + +using array_float_3 = std::array<float, 3>; + +/** + * This matches #OBJCurve's member functions, except that all the numbers and names are known + * constants. Used to store expected values of NURBS Curve sobjects. + */ +class NurbsObject { + private: + std::string nurbs_name_; + /* The indices in these vectors are spline indices. */ + std::vector<std::vector<array_float_3>> coordinates_; + std::vector<int> degrees_; + std::vector<int> control_points_; + + public: + NurbsObject(const std::string nurbs_name, + const std::vector<std::vector<array_float_3>> coordinates, + const std::vector<int> degrees, + const std::vector<int> control_points) + : nurbs_name_(nurbs_name), + coordinates_(coordinates), + degrees_(degrees), + control_points_(control_points) + { + } + + int total_splines() const + { + return coordinates_.size(); + } + + int total_spline_vertices(const int spline_index) const + { + if (spline_index >= coordinates_.size()) { + ADD_FAILURE(); + return 0; + } + return coordinates_[spline_index].size(); + } + + const float *vertex_coordinates(const int spline_index, const int vertex_index) const + { + return coordinates_[spline_index][vertex_index].data(); + } + + int get_nurbs_degree(const int spline_index) const + { + return degrees_[spline_index]; + } + + int total_spline_control_points(const int spline_index) const + { + return control_points_[spline_index]; + } +}; + +struct OBJExportParamsDefault { + OBJExportParams params; + OBJExportParamsDefault() + { + params.filepath[0] = '\0'; + params.blen_filepath = ""; + params.export_animation = false; + params.start_frame = 0; + params.end_frame = 1; + + params.forward_axis = OBJ_AXIS_NEGATIVE_Z_FORWARD; + params.up_axis = OBJ_AXIS_Y_UP; + params.scaling_factor = 1.f; + + params.export_eval_mode = DAG_EVAL_VIEWPORT; + params.export_selected_objects = false; + params.export_uv = true; + params.export_normals = true; + params.export_materials = true; + params.export_triangulated_mesh = false; + params.export_curves_as_nurbs = false; + + params.export_object_groups = false; + params.export_material_groups = false; + params.export_vertex_groups = false; + params.export_smooth_groups = true; + params.smooth_groups_bitflags = false; + } +}; + +const std::vector<std::vector<array_float_3>> coordinates_NurbsCurve{ + {{6.94742, 0.000000, 0.000000}, + {7.44742, 0.000000, -1.000000}, + {9.44742, 0.000000, -1.000000}, + {9.94742, 0.000000, 0.000000}}}; +const std::vector<std::vector<array_float_3>> coordinates_NurbsCircle{ + {{11.463165, 0.000000, 1.000000}, + {10.463165, 0.000000, 1.000000}, + {10.463165, 0.000000, 0.000000}, + {10.463165, 0.000000, -1.000000}, + {11.463165, 0.000000, -1.000000}, + {12.463165, 0.000000, -1.000000}, + {12.463165, 0.000000, 0.000000}, + {12.463165, 0.000000, 1.000000}}}; +const std::vector<std::vector<array_float_3>> coordinates_NurbsPathCurve{ + {{13.690557, 0.000000, 0.000000}, + {14.690557, 0.000000, 0.000000}, + {15.690557, 0.000000, 0.000000}, + {16.690557, 0.000000, 0.000000}, + {17.690557, 0.000000, 0.000000}}, + {{14.192808, 0.000000, 0.000000}, + {14.692808, 0.000000, -1.000000}, + {16.692808, 0.000000, -1.000000}, + {17.192808, 0.000000, 0.000000}}}; + +const std::map<std::string, std::unique_ptr<NurbsObject>> all_nurbs_truth = []() { + std::map<std::string, std::unique_ptr<NurbsObject>> all_nurbs; + all_nurbs.emplace( + "NurbsCurve", + /* Name, coordinates, degrees of splines, control points of splines. */ + std::make_unique<NurbsObject>( + "NurbsCurve", coordinates_NurbsCurve, std::vector<int>{3}, std::vector<int>{4})); + all_nurbs.emplace( + "NurbsCircle", + std::make_unique<NurbsObject>( + "NurbsCircle", coordinates_NurbsCircle, std::vector<int>{3}, std::vector<int>{11})); + /* This is actually an Object containing a NurbsPath and a NurbsCurve spline. */ + all_nurbs.emplace("NurbsPathCurve", + std::make_unique<NurbsObject>("NurbsPathCurve", + coordinates_NurbsPathCurve, + std::vector<int>{3, 3}, + std::vector<int>{5, 4})); + return all_nurbs; +}(); +} // namespace blender::io::obj diff --git a/source/blender/makesrna/intern/rna_cloth.c b/source/blender/makesrna/intern/rna_cloth.c index 2bc00dd5af5..187e232b030 100644 --- a/source/blender/makesrna/intern/rna_cloth.c +++ b/source/blender/makesrna/intern/rna_cloth.c @@ -584,6 +584,8 @@ static void rna_def_cloth_sim_settings(BlenderRNA *brna) RNA_def_struct_sdna(srna, "ClothSimSettings"); RNA_def_struct_path_func(srna, "rna_ClothSettings_path"); + RNA_define_lib_overridable(true); + /* goal */ prop = RNA_def_property(srna, "goal_min", PROP_FLOAT, PROP_FACTOR); @@ -659,6 +661,7 @@ static void rna_def_cloth_sim_settings(BlenderRNA *brna) "rna_ClothSettings_mass_vgroup_get", "rna_ClothSettings_mass_vgroup_length", "rna_ClothSettings_mass_vgroup_set"); + RNA_def_property_override_clear_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_ui_text(prop, "Mass Vertex Group", "Vertex Group for pinning of vertices"); RNA_def_property_update(prop, 0, "rna_cloth_pinning_changed"); @@ -707,6 +710,7 @@ static void rna_def_cloth_sim_settings(BlenderRNA *brna) "rna_ClothSettings_shrink_vgroup_get", "rna_ClothSettings_shrink_vgroup_length", "rna_ClothSettings_shrink_vgroup_set"); + RNA_def_property_override_clear_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_ui_text(prop, "Shrink Vertex Group", "Vertex Group for shrinking cloth"); RNA_def_property_update(prop, 0, "rna_cloth_update"); @@ -810,6 +814,7 @@ static void rna_def_cloth_sim_settings(BlenderRNA *brna) "rna_ClothSettings_struct_vgroup_get", "rna_ClothSettings_struct_vgroup_length", "rna_ClothSettings_struct_vgroup_set"); + RNA_def_property_override_clear_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_ui_text(prop, "Structural Stiffness Vertex Group", "Vertex group for fine control over structural stiffness"); @@ -820,6 +825,7 @@ static void rna_def_cloth_sim_settings(BlenderRNA *brna) "rna_ClothSettings_shear_vgroup_get", "rna_ClothSettings_shear_vgroup_length", "rna_ClothSettings_shear_vgroup_set"); + RNA_def_property_override_clear_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_ui_text( prop, "Shear Stiffness Vertex Group", "Vertex group for fine control over shear stiffness"); RNA_def_property_update(prop, 0, "rna_cloth_update"); @@ -856,6 +862,7 @@ static void rna_def_cloth_sim_settings(BlenderRNA *brna) "rna_ClothSettings_bend_vgroup_get", "rna_ClothSettings_bend_vgroup_length", "rna_ClothSettings_bend_vgroup_set"); + RNA_def_property_override_clear_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_ui_text(prop, "Bending Stiffness Vertex Group", "Vertex group for fine control over bending stiffness"); @@ -874,6 +881,7 @@ static void rna_def_cloth_sim_settings(BlenderRNA *brna) "rna_ClothSettings_rest_shape_key_set", NULL, NULL); + RNA_def_property_override_clear_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_ui_text( prop, "Rest Shape Key", "Shape key to use the rest spring lengths from"); RNA_def_property_update(prop, 0, "rna_cloth_update"); @@ -976,6 +984,7 @@ static void rna_def_cloth_sim_settings(BlenderRNA *brna) "rna_ClothSettings_internal_vgroup_get", "rna_ClothSettings_internal_vgroup_length", "rna_ClothSettings_internal_vgroup_set"); + RNA_def_property_override_clear_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_ui_text(prop, "Internal Springs Vertex Group", "Vertex group for fine control over the internal spring stiffness"); @@ -1044,6 +1053,7 @@ static void rna_def_cloth_sim_settings(BlenderRNA *brna) "rna_ClothSettings_pressure_vgroup_get", "rna_ClothSettings_pressure_vgroup_length", "rna_ClothSettings_pressure_vgroup_set"); + RNA_def_property_override_clear_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_ui_text( prop, "Pressure Vertex Group", @@ -1082,6 +1092,8 @@ static void rna_def_cloth_sim_settings(BlenderRNA *brna) RNA_def_property_ui_text( prop, "Maximum Spring Extension", "Maximum extension before spring gets cut"); # endif + + RNA_define_lib_overridable(false); } static void rna_def_cloth_collision_settings(BlenderRNA *brna) @@ -1097,6 +1109,8 @@ static void rna_def_cloth_collision_settings(BlenderRNA *brna) RNA_def_struct_sdna(srna, "ClothCollSettings"); RNA_def_struct_path_func(srna, "rna_ClothCollisionSettings_path"); + RNA_define_lib_overridable(true); + /* general collision */ prop = RNA_def_property(srna, "use_collision", PROP_BOOLEAN, PROP_NONE); @@ -1169,7 +1183,6 @@ static void rna_def_cloth_collision_settings(BlenderRNA *brna) prop = RNA_def_property(srna, "collection", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "group"); RNA_def_property_flag(prop, PROP_EDITABLE); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_ui_text(prop, "Collision Collection", "Limit colliders to this Collection"); RNA_def_property_update(prop, 0, "rna_cloth_dependency_update"); @@ -1178,6 +1191,7 @@ static void rna_def_cloth_collision_settings(BlenderRNA *brna) "rna_CollSettings_selfcol_vgroup_get", "rna_CollSettings_selfcol_vgroup_length", "rna_CollSettings_selfcol_vgroup_set"); + RNA_def_property_override_clear_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_ui_text( prop, "Selfcollision Vertex Group", @@ -1189,6 +1203,7 @@ static void rna_def_cloth_collision_settings(BlenderRNA *brna) "rna_CollSettings_objcol_vgroup_get", "rna_CollSettings_objcol_vgroup_length", "rna_CollSettings_objcol_vgroup_set"); + RNA_def_property_override_clear_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_ui_text( prop, "Collision Vertex Group", @@ -1203,6 +1218,8 @@ static void rna_def_cloth_collision_settings(BlenderRNA *brna) "Impulse Clamping", "Clamp collision impulses to avoid instability (0.0 to disable clamping)"); RNA_def_property_update(prop, 0, "rna_cloth_update"); + + RNA_define_lib_overridable(false); } void RNA_def_cloth(BlenderRNA *brna) diff --git a/source/blender/makesrna/intern/rna_dynamicpaint.c b/source/blender/makesrna/intern/rna_dynamicpaint.c index a9d5ef089bb..b693d78a302 100644 --- a/source/blender/makesrna/intern/rna_dynamicpaint.c +++ b/source/blender/makesrna/intern/rna_dynamicpaint.c @@ -589,6 +589,7 @@ static void rna_def_canvas_surface(BlenderRNA *brna) prop = RNA_def_property(srna, "effector_weights", PROP_POINTER, PROP_NONE); RNA_def_property_struct_type(prop, "EffectorWeights"); RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_ui_text(prop, "Effector Weights", ""); prop = RNA_def_property(srna, "drip_velocity", PROP_FLOAT, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_fluid.c b/source/blender/makesrna/intern/rna_fluid.c index 90e77406f23..7aa96eb8430 100644 --- a/source/blender/makesrna/intern/rna_fluid.c +++ b/source/blender/makesrna/intern/rna_fluid.c @@ -1461,6 +1461,7 @@ static void rna_def_fluid_domain_settings(BlenderRNA *brna) prop = RNA_def_property(srna, "effector_weights", PROP_POINTER, PROP_NONE); RNA_def_property_struct_type(prop, "EffectorWeights"); RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_ui_text(prop, "Effector Weights", ""); /* object collections */ diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index f6751117d55..98de40ead93 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -1953,7 +1953,7 @@ static bNodeType *rna_Node_register_base(Main *bmain, /* setup dummy node & node type to store static properties in */ memset(&dummynt, 0, sizeof(bNodeType)); /* this does some additional initialization of default values */ - node_type_base_custom(&dummynt, identifier, "", 0, 0); + node_type_base_custom(&dummynt, identifier, "", 0); memset(&dummynode, 0, sizeof(bNode)); dummynode.typeinfo = &dummynt; diff --git a/source/blender/makesrna/intern/rna_object_force.c b/source/blender/makesrna/intern/rna_object_force.c index 2fca9f0af7a..d697a48e04b 100644 --- a/source/blender/makesrna/intern/rna_object_force.c +++ b/source/blender/makesrna/intern/rna_object_force.c @@ -1128,6 +1128,8 @@ static void rna_def_collision(BlenderRNA *brna) RNA_def_struct_ui_text( srna, "Collision Settings", "Collision settings for object in physics simulation"); + RNA_define_lib_overridable(true); + prop = RNA_def_property(srna, "use", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "deflect", 1); RNA_def_property_ui_text( @@ -1230,6 +1232,8 @@ static void rna_def_collision(BlenderRNA *brna) "Cloth collision impulses act in the direction of the collider normals " "(more reliable in some cases)"); RNA_def_property_update(prop, 0, "rna_CollisionSettings_update"); + + RNA_define_lib_overridable(false); } static void rna_def_effector_weight(BlenderRNA *brna) @@ -1243,6 +1247,8 @@ static void rna_def_effector_weight(BlenderRNA *brna) RNA_def_struct_ui_text(srna, "Effector Weights", "Effector weights for physics simulation"); RNA_def_struct_ui_icon(srna, ICON_PHYSICS); + RNA_define_lib_overridable(true); + /* Flags */ prop = RNA_def_property(srna, "apply_to_hair_growing", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", EFF_WEIGHT_DO_HAIR); @@ -1362,6 +1368,8 @@ static void rna_def_effector_weight(BlenderRNA *brna) RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3); RNA_def_property_ui_text(prop, "Fluid Flow", "Fluid Flow effector weight"); RNA_def_property_update(prop, 0, "rna_EffectorWeight_update"); + + RNA_define_lib_overridable(false); } static void rna_def_field(BlenderRNA *brna) @@ -1471,6 +1479,8 @@ static void rna_def_field(BlenderRNA *brna) srna, "Field Settings", "Field settings for an object in physics simulation"); RNA_def_struct_ui_icon(srna, ICON_PHYSICS); + RNA_define_lib_overridable(true); + /* Enums */ prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE); @@ -1514,34 +1524,34 @@ static void rna_def_field(BlenderRNA *brna) prop = RNA_def_property(srna, "strength", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "f_strength"); - RNA_def_property_range(prop, -FLT_MAX, FLT_MAX); + RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 10, 3); RNA_def_property_ui_text(prop, "Strength", "Strength of force field"); RNA_def_property_update(prop, 0, "rna_FieldSettings_update"); /* different ui range to above */ prop = RNA_def_property(srna, "linear_drag", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "f_strength"); - RNA_def_property_range(prop, -2.0f, 2.0f); + RNA_def_property_ui_range(prop, -2.0f, 2.0f, 10, 3); RNA_def_property_ui_text(prop, "Linear Drag", "Drag component proportional to velocity"); RNA_def_property_update(prop, 0, "rna_FieldSettings_update"); prop = RNA_def_property(srna, "harmonic_damping", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "f_damp"); - RNA_def_property_range(prop, 0.0f, 10.0f); + RNA_def_property_ui_range(prop, 0.0f, 10.0f, 10, 3); RNA_def_property_ui_text(prop, "Harmonic Damping", "Damping of the harmonic force"); RNA_def_property_update(prop, 0, "rna_FieldSettings_update"); /* different ui range to above */ prop = RNA_def_property(srna, "quadratic_drag", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "f_damp"); - RNA_def_property_range(prop, -2.0f, 2.0f); + RNA_def_property_ui_range(prop, -2.0f, 2.0f, 10, 3); RNA_def_property_ui_text( prop, "Quadratic Drag", "Drag component proportional to the square of velocity"); RNA_def_property_update(prop, 0, "rna_FieldSettings_update"); prop = RNA_def_property(srna, "flow", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "f_flow"); - RNA_def_property_range(prop, 0.0f, 10.0f); + RNA_def_property_ui_range(prop, 0.0f, 10.0f, 10, 3); RNA_def_property_ui_text(prop, "Flow", "Convert effector force into air flow velocity"); RNA_def_property_update(prop, 0, "rna_FieldSettings_update"); @@ -1557,7 +1567,7 @@ static void rna_def_field(BlenderRNA *brna) /* different ui range to above */ prop = RNA_def_property(srna, "inflow", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "f_flow"); - RNA_def_property_range(prop, -10.0f, 10.0f); + RNA_def_property_ui_range(prop, -10.0f, 10.0f, 10, 3); RNA_def_property_ui_text(prop, "Inflow", "Inwards component of the vortex force"); RNA_def_property_update(prop, 0, "rna_FieldSettings_update"); @@ -1570,7 +1580,8 @@ static void rna_def_field(BlenderRNA *brna) prop = RNA_def_property(srna, "rest_length", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "f_size"); - RNA_def_property_range(prop, 0.0f, 1000.0f); + RNA_def_property_range(prop, 0.0f, FLT_MAX); + RNA_def_property_ui_range(prop, 0.0f, 1000.0f, 10, 3); RNA_def_property_ui_text(prop, "Rest Length", "Rest length of the harmonic force"); RNA_def_property_update(prop, 0, "rna_FieldSettings_update"); @@ -1728,7 +1739,7 @@ static void rna_def_field(BlenderRNA *brna) prop = RNA_def_property(srna, "guide_minimum", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "f_strength"); - RNA_def_property_range(prop, 0.0f, 1000.0f); + RNA_def_property_ui_range(prop, 0.0f, 1000.0f, 10, 3); RNA_def_property_ui_text( prop, "Minimum Distance", "The distance from which particles are affected fully"); RNA_def_property_update(prop, 0, "rna_FieldSettings_update"); @@ -1799,6 +1810,8 @@ static void rna_def_field(BlenderRNA *brna) /* Variables used for Curve Guide, already wrapped, used for other fields too */ /* falloff_power, use_max_distance, maximum_distance */ + + RNA_define_lib_overridable(false); } static void rna_def_softbody(BlenderRNA *brna) @@ -2134,6 +2147,7 @@ static void rna_def_softbody(BlenderRNA *brna) RNA_def_property_pointer_sdna(prop, NULL, "effector_weights"); RNA_def_property_struct_type(prop, "EffectorWeights"); RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_ui_text(prop, "Effector Weights", ""); } diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c index f732e14d905..fbc7625d815 100644 --- a/source/blender/makesrna/intern/rna_particle.c +++ b/source/blender/makesrna/intern/rna_particle.c @@ -3498,6 +3498,7 @@ static void rna_def_particle_settings(BlenderRNA *brna) prop = RNA_def_property(srna, "effector_weights", PROP_POINTER, PROP_NONE); RNA_def_property_struct_type(prop, "EffectorWeights"); RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_ui_text(prop, "Effector Weights", ""); /* animation here? */ @@ -3507,12 +3508,14 @@ static void rna_def_particle_settings(BlenderRNA *brna) RNA_def_property_pointer_sdna(prop, NULL, "pd"); RNA_def_property_struct_type(prop, "FieldSettings"); RNA_def_property_pointer_funcs(prop, "rna_Particle_field1_get", NULL, NULL, NULL); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_ui_text(prop, "Force Field 1", ""); prop = RNA_def_property(srna, "force_field_2", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "pd2"); RNA_def_property_struct_type(prop, "FieldSettings"); RNA_def_property_pointer_funcs(prop, "rna_Particle_field2_get", NULL, NULL, NULL); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_ui_text(prop, "Force Field 2", ""); /* twist */ diff --git a/source/blender/makesrna/intern/rna_rigidbody.c b/source/blender/makesrna/intern/rna_rigidbody.c index c0fb904101d..10e28ac3948 100644 --- a/source/blender/makesrna/intern/rna_rigidbody.c +++ b/source/blender/makesrna/intern/rna_rigidbody.c @@ -957,6 +957,7 @@ static void rna_def_rigidbody_world(BlenderRNA *brna) prop = RNA_def_property(srna, "effector_weights", PROP_POINTER, PROP_NONE); RNA_def_property_struct_type(prop, "EffectorWeights"); RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_ui_text(prop, "Effector Weights", ""); /* Sweep test */ diff --git a/source/blender/modifiers/intern/MOD_mask.cc b/source/blender/modifiers/intern/MOD_mask.cc index f452b0c7091..090c4d5512e 100644 --- a/source/blender/modifiers/intern/MOD_mask.cc +++ b/source/blender/modifiers/intern/MOD_mask.cc @@ -702,7 +702,7 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *UNUSED(ctx) Object *armature_ob = mmd->ob_arm; /* Return input mesh if there is no armature with bones. */ - if (ELEM(NULL, armature_ob, armature_ob->pose)) { + if (ELEM(nullptr, armature_ob, armature_ob->pose)) { return mesh; } diff --git a/source/blender/nodes/NOD_geometry.h b/source/blender/nodes/NOD_geometry.h index 2735dc445e2..96a5e1d87a6 100644 --- a/source/blender/nodes/NOD_geometry.h +++ b/source/blender/nodes/NOD_geometry.h @@ -106,6 +106,7 @@ void register_node_type_geo_input_id(void); void register_node_type_geo_input_index(void); void register_node_type_geo_input_material_index(void); void register_node_type_geo_input_material(void); +void register_node_type_geo_input_mesh_edge_angle(void); void register_node_type_geo_input_mesh_edge_neighbors(void); void register_node_type_geo_input_mesh_edge_vertices(void); void register_node_type_geo_input_mesh_face_area(void); diff --git a/source/blender/nodes/NOD_static_types.h b/source/blender/nodes/NOD_static_types.h index 108a37d0176..74f1531bd90 100644 --- a/source/blender/nodes/NOD_static_types.h +++ b/source/blender/nodes/NOD_static_types.h @@ -359,6 +359,7 @@ DefNode(GeometryNode, GEO_NODE_INPUT_ID, 0, "INPUT_ID", InputID, "ID", "") DefNode(GeometryNode, GEO_NODE_INPUT_INDEX, 0, "INDEX", InputIndex, "Index", "") DefNode(GeometryNode, GEO_NODE_INPUT_MATERIAL_INDEX, 0, "INPUT_MATERIAL_INDEX", InputMaterialIndex, "Material Index", "") DefNode(GeometryNode, GEO_NODE_INPUT_MATERIAL, def_geo_input_material, "INPUT_MATERIAL", InputMaterial, "Material", "") +DefNode(GeometryNode, GEO_NODE_INPUT_MESH_EDGE_ANGLE, 0, "MESH_EDGE_ANGLE", InputMeshEdgeAngle, "Edge Angle", "") DefNode(GeometryNode, GEO_NODE_INPUT_MESH_EDGE_NEIGHBORS, 0, "MESH_EDGE_NEIGHBORS", InputMeshEdgeNeighbors, "Edge Neighbors", "") DefNode(GeometryNode, GEO_NODE_INPUT_MESH_EDGE_VERTICES, 0, "MESH_EDGE_VERTICES", InputMeshEdgeVertices, "Edge Vertices", "") DefNode(GeometryNode, GEO_NODE_INPUT_MESH_FACE_AREA, 0, "MESH_FACE_AREA", InputMeshFaceArea, "Face Area", "") diff --git a/source/blender/nodes/composite/node_composite_util.cc b/source/blender/nodes/composite/node_composite_util.cc index 1262dfad11f..1f892c1c9e2 100644 --- a/source/blender/nodes/composite/node_composite_util.cc +++ b/source/blender/nodes/composite/node_composite_util.cc @@ -47,9 +47,9 @@ void cmp_node_update_default(bNodeTree *UNUSED(ntree), bNode *node) node->need_exec = 1; } -void cmp_node_type_base(bNodeType *ntype, int type, const char *name, short nclass, short flag) +void cmp_node_type_base(bNodeType *ntype, int type, const char *name, short nclass) { - node_type_base(ntype, type, name, nclass, flag); + node_type_base(ntype, type, name, nclass); ntype->poll = cmp_node_poll_default; ntype->updatefunc = cmp_node_update_default; diff --git a/source/blender/nodes/composite/node_composite_util.hh b/source/blender/nodes/composite/node_composite_util.hh index 04708d0d854..65dbc2065ef 100644 --- a/source/blender/nodes/composite/node_composite_util.hh +++ b/source/blender/nodes/composite/node_composite_util.hh @@ -52,5 +52,4 @@ bool cmp_node_poll_default(struct bNodeType *ntype, struct bNodeTree *ntree, const char **r_disabled_hint); void cmp_node_update_default(struct bNodeTree *ntree, struct bNode *node); -void cmp_node_type_base( - struct bNodeType *ntype, int type, const char *name, short nclass, short flag); +void cmp_node_type_base(struct bNodeType *ntype, int type, const char *name, short nclass); diff --git a/source/blender/nodes/composite/nodes/node_composite_alphaOver.cc b/source/blender/nodes/composite/nodes/node_composite_alphaOver.cc index f02842b2c66..82ef5df8403 100644 --- a/source/blender/nodes/composite/nodes/node_composite_alphaOver.cc +++ b/source/blender/nodes/composite/nodes/node_composite_alphaOver.cc @@ -58,7 +58,7 @@ void register_node_type_cmp_alphaover() { static bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_ALPHAOVER, "Alpha Over", NODE_CLASS_OP_COLOR, 0); + cmp_node_type_base(&ntype, CMP_NODE_ALPHAOVER, "Alpha Over", NODE_CLASS_OP_COLOR); ntype.declare = blender::nodes::cmp_node_alphaover_declare; ntype.draw_buttons = node_composit_buts_alphaover; node_type_init(&ntype, node_alphaover_init); diff --git a/source/blender/nodes/composite/nodes/node_composite_antialiasing.cc b/source/blender/nodes/composite/nodes/node_composite_antialiasing.cc index 55bfbadf5b2..b42b219ced9 100644 --- a/source/blender/nodes/composite/nodes/node_composite_antialiasing.cc +++ b/source/blender/nodes/composite/nodes/node_composite_antialiasing.cc @@ -66,10 +66,10 @@ void register_node_type_cmp_antialiasing() { static bNodeType ntype; - cmp_node_type_base( - &ntype, CMP_NODE_ANTIALIASING, "Anti-Aliasing", NODE_CLASS_OP_FILTER, NODE_PREVIEW); + cmp_node_type_base(&ntype, CMP_NODE_ANTIALIASING, "Anti-Aliasing", NODE_CLASS_OP_FILTER); ntype.declare = blender::nodes::cmp_node_antialiasing_declare; ntype.draw_buttons = node_composit_buts_antialiasing; + ntype.flag |= NODE_PREVIEW; node_type_size(&ntype, 170, 140, 200); node_type_init(&ntype, node_composit_init_antialiasing); node_type_storage( diff --git a/source/blender/nodes/composite/nodes/node_composite_bilateralblur.cc b/source/blender/nodes/composite/nodes/node_composite_bilateralblur.cc index 9c133e1a00c..2b4030935a0 100644 --- a/source/blender/nodes/composite/nodes/node_composite_bilateralblur.cc +++ b/source/blender/nodes/composite/nodes/node_composite_bilateralblur.cc @@ -64,7 +64,7 @@ void register_node_type_cmp_bilateralblur() { static bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_BILATERALBLUR, "Bilateral Blur", NODE_CLASS_OP_FILTER, 0); + cmp_node_type_base(&ntype, CMP_NODE_BILATERALBLUR, "Bilateral Blur", NODE_CLASS_OP_FILTER); ntype.declare = blender::nodes::cmp_node_bilateralblur_declare; ntype.draw_buttons = node_composit_buts_bilateralblur; node_type_init(&ntype, node_composit_init_bilateralblur); diff --git a/source/blender/nodes/composite/nodes/node_composite_blur.cc b/source/blender/nodes/composite/nodes/node_composite_blur.cc index 16eac697da1..b7904ffdafe 100644 --- a/source/blender/nodes/composite/nodes/node_composite_blur.cc +++ b/source/blender/nodes/composite/nodes/node_composite_blur.cc @@ -94,9 +94,10 @@ void register_node_type_cmp_blur() { static bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_BLUR, "Blur", NODE_CLASS_OP_FILTER, NODE_PREVIEW); + cmp_node_type_base(&ntype, CMP_NODE_BLUR, "Blur", NODE_CLASS_OP_FILTER); ntype.declare = blender::nodes::cmp_node_blur_declare; ntype.draw_buttons = node_composit_buts_blur; + ntype.flag |= NODE_PREVIEW; node_type_init(&ntype, node_composit_init_blur); node_type_storage( &ntype, "NodeBlurData", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/composite/nodes/node_composite_bokehblur.cc b/source/blender/nodes/composite/nodes/node_composite_bokehblur.cc index d0659f6a51e..2ecdedf5da1 100644 --- a/source/blender/nodes/composite/nodes/node_composite_bokehblur.cc +++ b/source/blender/nodes/composite/nodes/node_composite_bokehblur.cc @@ -60,7 +60,7 @@ void register_node_type_cmp_bokehblur() { static bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_BOKEHBLUR, "Bokeh Blur", NODE_CLASS_OP_FILTER, 0); + cmp_node_type_base(&ntype, CMP_NODE_BOKEHBLUR, "Bokeh Blur", NODE_CLASS_OP_FILTER); ntype.declare = blender::nodes::cmp_node_bokehblur_declare; ntype.draw_buttons = node_composit_buts_bokehblur; node_type_init(&ntype, node_composit_init_bokehblur); diff --git a/source/blender/nodes/composite/nodes/node_composite_bokehimage.cc b/source/blender/nodes/composite/nodes/node_composite_bokehimage.cc index 43ce6d485c5..005638ad5df 100644 --- a/source/blender/nodes/composite/nodes/node_composite_bokehimage.cc +++ b/source/blender/nodes/composite/nodes/node_composite_bokehimage.cc @@ -67,9 +67,10 @@ void register_node_type_cmp_bokehimage() { static bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_BOKEHIMAGE, "Bokeh Image", NODE_CLASS_INPUT, NODE_PREVIEW); + cmp_node_type_base(&ntype, CMP_NODE_BOKEHIMAGE, "Bokeh Image", NODE_CLASS_INPUT); ntype.declare = blender::nodes::cmp_node_bokehimage_declare; ntype.draw_buttons = node_composit_buts_bokehimage; + ntype.flag |= NODE_PREVIEW; node_type_init(&ntype, node_composit_init_bokehimage); node_type_storage( &ntype, "NodeBokehImage", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/composite/nodes/node_composite_boxmask.cc b/source/blender/nodes/composite/nodes/node_composite_boxmask.cc index a42242809eb..326a51e57ba 100644 --- a/source/blender/nodes/composite/nodes/node_composite_boxmask.cc +++ b/source/blender/nodes/composite/nodes/node_composite_boxmask.cc @@ -70,7 +70,7 @@ void register_node_type_cmp_boxmask() { static bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_MASK_BOX, "Box Mask", NODE_CLASS_MATTE, 0); + cmp_node_type_base(&ntype, CMP_NODE_MASK_BOX, "Box Mask", NODE_CLASS_MATTE); ntype.declare = blender::nodes::cmp_node_boxmask_declare; ntype.draw_buttons = node_composit_buts_boxmask; node_type_init(&ntype, node_composit_init_boxmask); diff --git a/source/blender/nodes/composite/nodes/node_composite_brightness.cc b/source/blender/nodes/composite/nodes/node_composite_brightness.cc index ca03a9b4fbf..ea1684a6ca7 100644 --- a/source/blender/nodes/composite/nodes/node_composite_brightness.cc +++ b/source/blender/nodes/composite/nodes/node_composite_brightness.cc @@ -56,7 +56,7 @@ void register_node_type_cmp_brightcontrast() { static bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_BRIGHTCONTRAST, "Bright/Contrast", NODE_CLASS_OP_COLOR, 0); + cmp_node_type_base(&ntype, CMP_NODE_BRIGHTCONTRAST, "Bright/Contrast", NODE_CLASS_OP_COLOR); ntype.declare = blender::nodes::cmp_node_brightcontrast_declare; ntype.draw_buttons = node_composit_buts_brightcontrast; node_type_init(&ntype, node_composit_init_brightcontrast); diff --git a/source/blender/nodes/composite/nodes/node_composite_channelMatte.cc b/source/blender/nodes/composite/nodes/node_composite_channelMatte.cc index a0d673a327d..9d3bc97f2dc 100644 --- a/source/blender/nodes/composite/nodes/node_composite_channelMatte.cc +++ b/source/blender/nodes/composite/nodes/node_composite_channelMatte.cc @@ -101,10 +101,10 @@ void register_node_type_cmp_channel_matte() { static bNodeType ntype; - cmp_node_type_base( - &ntype, CMP_NODE_CHANNEL_MATTE, "Channel Key", NODE_CLASS_MATTE, NODE_PREVIEW); + cmp_node_type_base(&ntype, CMP_NODE_CHANNEL_MATTE, "Channel Key", NODE_CLASS_MATTE); ntype.declare = blender::nodes::cmp_node_channel_matte_declare; ntype.draw_buttons = node_composit_buts_channel_matte; + ntype.flag |= NODE_PREVIEW; node_type_init(&ntype, node_composit_init_channel_matte); node_type_storage(&ntype, "NodeChroma", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/composite/nodes/node_composite_chromaMatte.cc b/source/blender/nodes/composite/nodes/node_composite_chromaMatte.cc index c85580b40c0..be27f747af0 100644 --- a/source/blender/nodes/composite/nodes/node_composite_chromaMatte.cc +++ b/source/blender/nodes/composite/nodes/node_composite_chromaMatte.cc @@ -71,9 +71,10 @@ void register_node_type_cmp_chroma_matte() { static bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_CHROMA_MATTE, "Chroma Key", NODE_CLASS_MATTE, NODE_PREVIEW); + cmp_node_type_base(&ntype, CMP_NODE_CHROMA_MATTE, "Chroma Key", NODE_CLASS_MATTE); ntype.declare = blender::nodes::cmp_node_chroma_matte_declare; ntype.draw_buttons = node_composit_buts_chroma_matte; + ntype.flag |= NODE_PREVIEW; node_type_init(&ntype, node_composit_init_chroma_matte); node_type_storage(&ntype, "NodeChroma", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/composite/nodes/node_composite_colorMatte.cc b/source/blender/nodes/composite/nodes/node_composite_colorMatte.cc index 181d2741477..58040c2076b 100644 --- a/source/blender/nodes/composite/nodes/node_composite_colorMatte.cc +++ b/source/blender/nodes/composite/nodes/node_composite_colorMatte.cc @@ -72,9 +72,10 @@ void register_node_type_cmp_color_matte() { static bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_COLOR_MATTE, "Color Key", NODE_CLASS_MATTE, NODE_PREVIEW); + cmp_node_type_base(&ntype, CMP_NODE_COLOR_MATTE, "Color Key", NODE_CLASS_MATTE); ntype.declare = blender::nodes::cmp_node_color_matte_declare; ntype.draw_buttons = node_composit_buts_color_matte; + ntype.flag |= NODE_PREVIEW; node_type_init(&ntype, node_composit_init_color_matte); node_type_storage(&ntype, "NodeChroma", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/composite/nodes/node_composite_colorSpill.cc b/source/blender/nodes/composite/nodes/node_composite_colorSpill.cc index da11dbd4474..187b1dfdfc5 100644 --- a/source/blender/nodes/composite/nodes/node_composite_colorSpill.cc +++ b/source/blender/nodes/composite/nodes/node_composite_colorSpill.cc @@ -102,7 +102,7 @@ void register_node_type_cmp_color_spill() { static bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_COLOR_SPILL, "Color Spill", NODE_CLASS_MATTE, 0); + cmp_node_type_base(&ntype, CMP_NODE_COLOR_SPILL, "Color Spill", NODE_CLASS_MATTE); ntype.declare = blender::nodes::cmp_node_color_spill_declare; ntype.draw_buttons = node_composit_buts_color_spill; node_type_init(&ntype, node_composit_init_color_spill); diff --git a/source/blender/nodes/composite/nodes/node_composite_colorbalance.cc b/source/blender/nodes/composite/nodes/node_composite_colorbalance.cc index 9d385a49f2e..bddd702bcca 100644 --- a/source/blender/nodes/composite/nodes/node_composite_colorbalance.cc +++ b/source/blender/nodes/composite/nodes/node_composite_colorbalance.cc @@ -161,7 +161,7 @@ void register_node_type_cmp_colorbalance() { static bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_COLORBALANCE, "Color Balance", NODE_CLASS_OP_COLOR, 0); + cmp_node_type_base(&ntype, CMP_NODE_COLORBALANCE, "Color Balance", NODE_CLASS_OP_COLOR); ntype.declare = blender::nodes::cmp_node_colorbalance_declare; ntype.draw_buttons = node_composit_buts_colorbalance; ntype.draw_buttons_ex = node_composit_buts_colorbalance_ex; diff --git a/source/blender/nodes/composite/nodes/node_composite_colorcorrection.cc b/source/blender/nodes/composite/nodes/node_composite_colorcorrection.cc index 49680e4e4cf..16d1ad90757 100644 --- a/source/blender/nodes/composite/nodes/node_composite_colorcorrection.cc +++ b/source/blender/nodes/composite/nodes/node_composite_colorcorrection.cc @@ -288,7 +288,7 @@ void register_node_type_cmp_colorcorrection() { static bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_COLORCORRECTION, "Color Correction", NODE_CLASS_OP_COLOR, 0); + cmp_node_type_base(&ntype, CMP_NODE_COLORCORRECTION, "Color Correction", NODE_CLASS_OP_COLOR); ntype.declare = blender::nodes::cmp_node_colorcorrection_declare; ntype.draw_buttons = node_composit_buts_colorcorrection; ntype.draw_buttons_ex = node_composit_buts_colorcorrection_ex; diff --git a/source/blender/nodes/composite/nodes/node_composite_common.cc b/source/blender/nodes/composite/nodes/node_composite_common.cc index aa81cecc3e2..36678baafa5 100644 --- a/source/blender/nodes/composite/nodes/node_composite_common.cc +++ b/source/blender/nodes/composite/nodes/node_composite_common.cc @@ -38,7 +38,7 @@ void register_node_type_cmp_group() /* NOTE: Cannot use sh_node_type_base for node group, because it would map the node type * to the shared NODE_GROUP integer type id. */ - node_type_base_custom(&ntype, "CompositorNodeGroup", "Group", NODE_CLASS_GROUP, 0); + node_type_base_custom(&ntype, "CompositorNodeGroup", "Group", NODE_CLASS_GROUP); ntype.type = NODE_GROUP; ntype.poll = cmp_node_poll_default; ntype.poll_instance = node_group_poll_instance; diff --git a/source/blender/nodes/composite/nodes/node_composite_composite.cc b/source/blender/nodes/composite/nodes/node_composite_composite.cc index 547e5123579..5f694d0738e 100644 --- a/source/blender/nodes/composite/nodes/node_composite_composite.cc +++ b/source/blender/nodes/composite/nodes/node_composite_composite.cc @@ -48,9 +48,10 @@ void register_node_type_cmp_composite() { static bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_COMPOSITE, "Composite", NODE_CLASS_OUTPUT, NODE_PREVIEW); + cmp_node_type_base(&ntype, CMP_NODE_COMPOSITE, "Composite", NODE_CLASS_OUTPUT); ntype.declare = blender::nodes::cmp_node_composite_declare; ntype.draw_buttons = node_composit_buts_composite; + ntype.flag |= NODE_PREVIEW; ntype.no_muting = true; nodeRegisterType(&ntype); diff --git a/source/blender/nodes/composite/nodes/node_composite_cornerpin.cc b/source/blender/nodes/composite/nodes/node_composite_cornerpin.cc index 2e7a87a576d..2bd188e4182 100644 --- a/source/blender/nodes/composite/nodes/node_composite_cornerpin.cc +++ b/source/blender/nodes/composite/nodes/node_composite_cornerpin.cc @@ -54,7 +54,7 @@ void register_node_type_cmp_cornerpin() { static bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_CORNERPIN, "Corner Pin", NODE_CLASS_DISTORT, 0); + cmp_node_type_base(&ntype, CMP_NODE_CORNERPIN, "Corner Pin", NODE_CLASS_DISTORT); ntype.declare = blender::nodes::cmp_node_cornerpin_declare; nodeRegisterType(&ntype); diff --git a/source/blender/nodes/composite/nodes/node_composite_crop.cc b/source/blender/nodes/composite/nodes/node_composite_crop.cc index 5b1641ce8d6..2969e0564b1 100644 --- a/source/blender/nodes/composite/nodes/node_composite_crop.cc +++ b/source/blender/nodes/composite/nodes/node_composite_crop.cc @@ -76,7 +76,7 @@ void register_node_type_cmp_crop() { static bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_CROP, "Crop", NODE_CLASS_DISTORT, 0); + cmp_node_type_base(&ntype, CMP_NODE_CROP, "Crop", NODE_CLASS_DISTORT); ntype.declare = blender::nodes::cmp_node_crop_declare; ntype.draw_buttons = node_composit_buts_crop; node_type_init(&ntype, node_composit_init_crop); diff --git a/source/blender/nodes/composite/nodes/node_composite_cryptomatte.cc b/source/blender/nodes/composite/nodes/node_composite_cryptomatte.cc index 8e05f7fb131..c059a2883f6 100644 --- a/source/blender/nodes/composite/nodes/node_composite_cryptomatte.cc +++ b/source/blender/nodes/composite/nodes/node_composite_cryptomatte.cc @@ -309,7 +309,7 @@ void register_node_type_cmp_cryptomatte() { static bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_CRYPTOMATTE, "Cryptomatte", NODE_CLASS_MATTE, 0); + cmp_node_type_base(&ntype, CMP_NODE_CRYPTOMATTE, "Cryptomatte", NODE_CLASS_MATTE); node_type_socket_templates(&ntype, cmp_node_cryptomatte_in, cmp_node_cryptomatte_out); node_type_size(&ntype, 240, 100, 700); node_type_init(&ntype, node_init_cryptomatte); @@ -366,7 +366,7 @@ void register_node_type_cmp_cryptomatte_legacy() { static bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_CRYPTOMATTE_LEGACY, "Cryptomatte", NODE_CLASS_MATTE, 0); + cmp_node_type_base(&ntype, CMP_NODE_CRYPTOMATTE_LEGACY, "Cryptomatte", NODE_CLASS_MATTE); node_type_socket_templates(&ntype, nullptr, cmp_node_cryptomatte_out); node_type_init(&ntype, node_init_cryptomatte_legacy); node_type_storage(&ntype, "NodeCryptomatte", node_free_cryptomatte, node_copy_cryptomatte); diff --git a/source/blender/nodes/composite/nodes/node_composite_curves.cc b/source/blender/nodes/composite/nodes/node_composite_curves.cc index 3ec54df2358..6be8a04a6e1 100644 --- a/source/blender/nodes/composite/nodes/node_composite_curves.cc +++ b/source/blender/nodes/composite/nodes/node_composite_curves.cc @@ -49,7 +49,7 @@ void register_node_type_cmp_curve_time() { static bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_TIME, "Time", NODE_CLASS_INPUT, 0); + cmp_node_type_base(&ntype, CMP_NODE_TIME, "Time", NODE_CLASS_INPUT); ntype.declare = blender::nodes::cmp_node_time_declare; node_type_size(&ntype, 200, 140, 320); node_type_init(&ntype, node_composit_init_curves_time); @@ -84,7 +84,7 @@ void register_node_type_cmp_curve_vec() { static bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_CURVE_VEC, "Vector Curves", NODE_CLASS_OP_VECTOR, 0); + cmp_node_type_base(&ntype, CMP_NODE_CURVE_VEC, "Vector Curves", NODE_CLASS_OP_VECTOR); ntype.declare = blender::nodes::cmp_node_curve_vec_declare; ntype.draw_buttons = node_buts_curvevec; node_type_size(&ntype, 200, 140, 320); @@ -119,7 +119,7 @@ void register_node_type_cmp_curve_rgb() { static bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_CURVE_RGB, "RGB Curves", NODE_CLASS_OP_COLOR, 0); + cmp_node_type_base(&ntype, CMP_NODE_CURVE_RGB, "RGB Curves", NODE_CLASS_OP_COLOR); ntype.declare = blender::nodes::cmp_node_rgbcurves_declare; node_type_size(&ntype, 200, 140, 320); node_type_init(&ntype, node_composit_init_curve_rgb); diff --git a/source/blender/nodes/composite/nodes/node_composite_defocus.cc b/source/blender/nodes/composite/nodes/node_composite_defocus.cc index a9b4ac066e5..cfe377f72f1 100644 --- a/source/blender/nodes/composite/nodes/node_composite_defocus.cc +++ b/source/blender/nodes/composite/nodes/node_composite_defocus.cc @@ -103,7 +103,7 @@ void register_node_type_cmp_defocus() { static bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_DEFOCUS, "Defocus", NODE_CLASS_OP_FILTER, 0); + cmp_node_type_base(&ntype, CMP_NODE_DEFOCUS, "Defocus", NODE_CLASS_OP_FILTER); ntype.declare = blender::nodes::cmp_node_defocus_declare; ntype.draw_buttons = node_composit_buts_defocus; node_type_init(&ntype, node_composit_init_defocus); diff --git a/source/blender/nodes/composite/nodes/node_composite_denoise.cc b/source/blender/nodes/composite/nodes/node_composite_denoise.cc index 06049d01431..8dce28b4ac0 100644 --- a/source/blender/nodes/composite/nodes/node_composite_denoise.cc +++ b/source/blender/nodes/composite/nodes/node_composite_denoise.cc @@ -76,7 +76,7 @@ void register_node_type_cmp_denoise() { static bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_DENOISE, "Denoise", NODE_CLASS_OP_FILTER, 0); + cmp_node_type_base(&ntype, CMP_NODE_DENOISE, "Denoise", NODE_CLASS_OP_FILTER); ntype.declare = blender::nodes::cmp_node_denoise_declare; ntype.draw_buttons = node_composit_buts_denoise; node_type_init(&ntype, node_composit_init_denonise); diff --git a/source/blender/nodes/composite/nodes/node_composite_despeckle.cc b/source/blender/nodes/composite/nodes/node_composite_despeckle.cc index 411bad14f25..3555bd6a693 100644 --- a/source/blender/nodes/composite/nodes/node_composite_despeckle.cc +++ b/source/blender/nodes/composite/nodes/node_composite_despeckle.cc @@ -58,9 +58,10 @@ void register_node_type_cmp_despeckle() { static bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_DESPECKLE, "Despeckle", NODE_CLASS_OP_FILTER, NODE_PREVIEW); + cmp_node_type_base(&ntype, CMP_NODE_DESPECKLE, "Despeckle", NODE_CLASS_OP_FILTER); ntype.declare = blender::nodes::cmp_node_despeckle_declare; ntype.draw_buttons = node_composit_buts_despeckle; + ntype.flag |= NODE_PREVIEW; node_type_init(&ntype, node_composit_init_despeckle); nodeRegisterType(&ntype); diff --git a/source/blender/nodes/composite/nodes/node_composite_diffMatte.cc b/source/blender/nodes/composite/nodes/node_composite_diffMatte.cc index 2987e7dc82c..2bc171161be 100644 --- a/source/blender/nodes/composite/nodes/node_composite_diffMatte.cc +++ b/source/blender/nodes/composite/nodes/node_composite_diffMatte.cc @@ -62,10 +62,10 @@ void register_node_type_cmp_diff_matte() { static bNodeType ntype; - cmp_node_type_base( - &ntype, CMP_NODE_DIFF_MATTE, "Difference Key", NODE_CLASS_MATTE, NODE_PREVIEW); + cmp_node_type_base(&ntype, CMP_NODE_DIFF_MATTE, "Difference Key", NODE_CLASS_MATTE); ntype.declare = blender::nodes::cmp_node_diff_matte_declare; ntype.draw_buttons = node_composit_buts_diff_matte; + ntype.flag |= NODE_PREVIEW; node_type_init(&ntype, node_composit_init_diff_matte); node_type_storage(&ntype, "NodeChroma", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/composite/nodes/node_composite_dilate.cc b/source/blender/nodes/composite/nodes/node_composite_dilate.cc index 1e7d92b3abb..867fc7f828f 100644 --- a/source/blender/nodes/composite/nodes/node_composite_dilate.cc +++ b/source/blender/nodes/composite/nodes/node_composite_dilate.cc @@ -65,7 +65,7 @@ void register_node_type_cmp_dilateerode() { static bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_DILATEERODE, "Dilate/Erode", NODE_CLASS_OP_FILTER, 0); + cmp_node_type_base(&ntype, CMP_NODE_DILATEERODE, "Dilate/Erode", NODE_CLASS_OP_FILTER); ntype.draw_buttons = node_composit_buts_dilateerode; ntype.declare = blender::nodes::cmp_node_dilate_declare; node_type_init(&ntype, node_composit_init_dilateerode); diff --git a/source/blender/nodes/composite/nodes/node_composite_directionalblur.cc b/source/blender/nodes/composite/nodes/node_composite_directionalblur.cc index 4a1a7019b1e..8f39a25cf77 100644 --- a/source/blender/nodes/composite/nodes/node_composite_directionalblur.cc +++ b/source/blender/nodes/composite/nodes/node_composite_directionalblur.cc @@ -73,7 +73,7 @@ void register_node_type_cmp_dblur() { static bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_DBLUR, "Directional Blur", NODE_CLASS_OP_FILTER, 0); + cmp_node_type_base(&ntype, CMP_NODE_DBLUR, "Directional Blur", NODE_CLASS_OP_FILTER); ntype.declare = blender::nodes::cmp_node_directional_blur_declare; ntype.draw_buttons = node_composit_buts_dblur; node_type_init(&ntype, node_composit_init_dblur); diff --git a/source/blender/nodes/composite/nodes/node_composite_displace.cc b/source/blender/nodes/composite/nodes/node_composite_displace.cc index 0137c1f7da8..dd53b3f46a5 100644 --- a/source/blender/nodes/composite/nodes/node_composite_displace.cc +++ b/source/blender/nodes/composite/nodes/node_composite_displace.cc @@ -46,7 +46,7 @@ void register_node_type_cmp_displace() { static bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_DISPLACE, "Displace", NODE_CLASS_DISTORT, 0); + cmp_node_type_base(&ntype, CMP_NODE_DISPLACE, "Displace", NODE_CLASS_DISTORT); ntype.declare = blender::nodes::cmp_node_displace_declare; nodeRegisterType(&ntype); diff --git a/source/blender/nodes/composite/nodes/node_composite_distanceMatte.cc b/source/blender/nodes/composite/nodes/node_composite_distanceMatte.cc index ef2ab9617bd..2b6d5068d74 100644 --- a/source/blender/nodes/composite/nodes/node_composite_distanceMatte.cc +++ b/source/blender/nodes/composite/nodes/node_composite_distanceMatte.cc @@ -70,9 +70,10 @@ void register_node_type_cmp_distance_matte() { static bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_DIST_MATTE, "Distance Key", NODE_CLASS_MATTE, NODE_PREVIEW); + cmp_node_type_base(&ntype, CMP_NODE_DIST_MATTE, "Distance Key", NODE_CLASS_MATTE); ntype.declare = blender::nodes::cmp_node_distance_matte_declare; ntype.draw_buttons = node_composit_buts_distance_matte; + ntype.flag |= NODE_PREVIEW; node_type_init(&ntype, node_composit_init_distance_matte); node_type_storage(&ntype, "NodeChroma", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/composite/nodes/node_composite_doubleEdgeMask.cc b/source/blender/nodes/composite/nodes/node_composite_doubleEdgeMask.cc index 4fde539e6fb..1a0d268941e 100644 --- a/source/blender/nodes/composite/nodes/node_composite_doubleEdgeMask.cc +++ b/source/blender/nodes/composite/nodes/node_composite_doubleEdgeMask.cc @@ -57,7 +57,7 @@ void register_node_type_cmp_doubleedgemask() { static bNodeType ntype; /* Allocate a node type data structure. */ - cmp_node_type_base(&ntype, CMP_NODE_DOUBLEEDGEMASK, "Double Edge Mask", NODE_CLASS_MATTE, 0); + cmp_node_type_base(&ntype, CMP_NODE_DOUBLEEDGEMASK, "Double Edge Mask", NODE_CLASS_MATTE); ntype.declare = blender::nodes::cmp_node_double_edge_mask_declare; ntype.draw_buttons = node_composit_buts_double_edge_mask; diff --git a/source/blender/nodes/composite/nodes/node_composite_ellipsemask.cc b/source/blender/nodes/composite/nodes/node_composite_ellipsemask.cc index b08aa8e2326..76efa46d147 100644 --- a/source/blender/nodes/composite/nodes/node_composite_ellipsemask.cc +++ b/source/blender/nodes/composite/nodes/node_composite_ellipsemask.cc @@ -68,7 +68,7 @@ void register_node_type_cmp_ellipsemask() { static bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_MASK_ELLIPSE, "Ellipse Mask", NODE_CLASS_MATTE, 0); + cmp_node_type_base(&ntype, CMP_NODE_MASK_ELLIPSE, "Ellipse Mask", NODE_CLASS_MATTE); ntype.declare = blender::nodes::cmp_node_ellipsemask_declare; ntype.draw_buttons = node_composit_buts_ellipsemask; node_type_size(&ntype, 260, 110, 320); diff --git a/source/blender/nodes/composite/nodes/node_composite_exposure.cc b/source/blender/nodes/composite/nodes/node_composite_exposure.cc index b696db41a3c..bee172b24c9 100644 --- a/source/blender/nodes/composite/nodes/node_composite_exposure.cc +++ b/source/blender/nodes/composite/nodes/node_composite_exposure.cc @@ -40,7 +40,7 @@ void register_node_type_cmp_exposure() { static bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_EXPOSURE, "Exposure", NODE_CLASS_OP_COLOR, 0); + cmp_node_type_base(&ntype, CMP_NODE_EXPOSURE, "Exposure", NODE_CLASS_OP_COLOR); ntype.declare = blender::nodes::cmp_node_exposure_declare; nodeRegisterType(&ntype); diff --git a/source/blender/nodes/composite/nodes/node_composite_filter.cc b/source/blender/nodes/composite/nodes/node_composite_filter.cc index 3671d502539..cc348af585e 100644 --- a/source/blender/nodes/composite/nodes/node_composite_filter.cc +++ b/source/blender/nodes/composite/nodes/node_composite_filter.cc @@ -48,10 +48,11 @@ void register_node_type_cmp_filter() { static bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_FILTER, "Filter", NODE_CLASS_OP_FILTER, NODE_PREVIEW); + cmp_node_type_base(&ntype, CMP_NODE_FILTER, "Filter", NODE_CLASS_OP_FILTER); ntype.declare = blender::nodes::cmp_node_filter_declare; ntype.draw_buttons = node_composit_buts_filter; ntype.labelfunc = node_filter_label; + ntype.flag |= NODE_PREVIEW; nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/composite/nodes/node_composite_flip.cc b/source/blender/nodes/composite/nodes/node_composite_flip.cc index 38bc0f8b855..1087254ac7a 100644 --- a/source/blender/nodes/composite/nodes/node_composite_flip.cc +++ b/source/blender/nodes/composite/nodes/node_composite_flip.cc @@ -47,7 +47,7 @@ void register_node_type_cmp_flip() { static bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_FLIP, "Flip", NODE_CLASS_DISTORT, 0); + cmp_node_type_base(&ntype, CMP_NODE_FLIP, "Flip", NODE_CLASS_DISTORT); ntype.declare = blender::nodes::cmp_node_flip_declare; ntype.draw_buttons = node_composit_buts_flip; diff --git a/source/blender/nodes/composite/nodes/node_composite_gamma.cc b/source/blender/nodes/composite/nodes/node_composite_gamma.cc index 438770865ae..2ad2b955b9d 100644 --- a/source/blender/nodes/composite/nodes/node_composite_gamma.cc +++ b/source/blender/nodes/composite/nodes/node_composite_gamma.cc @@ -44,7 +44,7 @@ void register_node_type_cmp_gamma() { static bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_GAMMA, "Gamma", NODE_CLASS_OP_COLOR, 0); + cmp_node_type_base(&ntype, CMP_NODE_GAMMA, "Gamma", NODE_CLASS_OP_COLOR); ntype.declare = blender::nodes::cmp_node_gamma_declare; nodeRegisterType(&ntype); diff --git a/source/blender/nodes/composite/nodes/node_composite_glare.cc b/source/blender/nodes/composite/nodes/node_composite_glare.cc index 7ec04b323b3..89701b3551a 100644 --- a/source/blender/nodes/composite/nodes/node_composite_glare.cc +++ b/source/blender/nodes/composite/nodes/node_composite_glare.cc @@ -97,7 +97,7 @@ void register_node_type_cmp_glare() { static bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_GLARE, "Glare", NODE_CLASS_OP_FILTER, 0); + cmp_node_type_base(&ntype, CMP_NODE_GLARE, "Glare", NODE_CLASS_OP_FILTER); ntype.declare = blender::nodes::cmp_node_glare_declare; ntype.draw_buttons = node_composit_buts_glare; node_type_init(&ntype, node_composit_init_glare); diff --git a/source/blender/nodes/composite/nodes/node_composite_hueSatVal.cc b/source/blender/nodes/composite/nodes/node_composite_hueSatVal.cc index 47fbaa4d384..5453ee4fae4 100644 --- a/source/blender/nodes/composite/nodes/node_composite_hueSatVal.cc +++ b/source/blender/nodes/composite/nodes/node_composite_hueSatVal.cc @@ -51,7 +51,7 @@ void register_node_type_cmp_hue_sat() { static bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_HUE_SAT, "Hue Saturation Value", NODE_CLASS_OP_COLOR, 0); + cmp_node_type_base(&ntype, CMP_NODE_HUE_SAT, "Hue Saturation Value", NODE_CLASS_OP_COLOR); ntype.declare = blender::nodes::cmp_node_huesatval_declare; nodeRegisterType(&ntype); diff --git a/source/blender/nodes/composite/nodes/node_composite_huecorrect.cc b/source/blender/nodes/composite/nodes/node_composite_huecorrect.cc index e78ba0c7f9c..a98e4cdd3ba 100644 --- a/source/blender/nodes/composite/nodes/node_composite_huecorrect.cc +++ b/source/blender/nodes/composite/nodes/node_composite_huecorrect.cc @@ -55,7 +55,7 @@ void register_node_type_cmp_huecorrect() { static bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_HUECORRECT, "Hue Correct", NODE_CLASS_OP_COLOR, 0); + cmp_node_type_base(&ntype, CMP_NODE_HUECORRECT, "Hue Correct", NODE_CLASS_OP_COLOR); ntype.declare = blender::nodes::cmp_node_huecorrect_declare; node_type_size(&ntype, 320, 140, 500); node_type_init(&ntype, node_composit_init_huecorrect); diff --git a/source/blender/nodes/composite/nodes/node_composite_idMask.cc b/source/blender/nodes/composite/nodes/node_composite_idMask.cc index f5b8cb6c567..c898734e758 100644 --- a/source/blender/nodes/composite/nodes/node_composite_idMask.cc +++ b/source/blender/nodes/composite/nodes/node_composite_idMask.cc @@ -48,7 +48,7 @@ void register_node_type_cmp_idmask() { static bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_ID_MASK, "ID Mask", NODE_CLASS_CONVERTER, 0); + cmp_node_type_base(&ntype, CMP_NODE_ID_MASK, "ID Mask", NODE_CLASS_CONVERTER); ntype.declare = blender::nodes::cmp_node_idmask_declare; ntype.draw_buttons = node_composit_buts_id_mask; diff --git a/source/blender/nodes/composite/nodes/node_composite_image.cc b/source/blender/nodes/composite/nodes/node_composite_image.cc index 8d81fe2c99b..bb87991630d 100644 --- a/source/blender/nodes/composite/nodes/node_composite_image.cc +++ b/source/blender/nodes/composite/nodes/node_composite_image.cc @@ -451,11 +451,12 @@ void register_node_type_cmp_image() { static bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_IMAGE, "Image", NODE_CLASS_INPUT, NODE_PREVIEW); + cmp_node_type_base(&ntype, CMP_NODE_IMAGE, "Image", NODE_CLASS_INPUT); node_type_init(&ntype, node_composit_init_image); node_type_storage(&ntype, "ImageUser", node_composit_free_image, node_composit_copy_image); node_type_update(&ntype, cmp_node_image_update); ntype.labelfunc = node_image_label; + ntype.flag |= NODE_PREVIEW; nodeRegisterType(&ntype); } @@ -605,11 +606,12 @@ void register_node_type_cmp_rlayers() { static bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_R_LAYERS, "Render Layers", NODE_CLASS_INPUT, NODE_PREVIEW); + cmp_node_type_base(&ntype, CMP_NODE_R_LAYERS, "Render Layers", NODE_CLASS_INPUT); node_type_socket_templates(&ntype, nullptr, cmp_node_rlayers_out); ntype.draw_buttons = node_composit_buts_viewlayers; ntype.initfunc_api = node_composit_init_rlayers; ntype.poll = node_composit_poll_rlayers; + ntype.flag |= NODE_PREVIEW; node_type_storage(&ntype, nullptr, node_composit_free_rlayers, node_composit_copy_rlayers); node_type_update(&ntype, cmp_node_rlayers_update); node_type_init(&ntype, node_cmp_rlayers_outputs); diff --git a/source/blender/nodes/composite/nodes/node_composite_inpaint.cc b/source/blender/nodes/composite/nodes/node_composite_inpaint.cc index 976b1cd5a15..6776837f002 100644 --- a/source/blender/nodes/composite/nodes/node_composite_inpaint.cc +++ b/source/blender/nodes/composite/nodes/node_composite_inpaint.cc @@ -47,7 +47,7 @@ void register_node_type_cmp_inpaint() { static bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_INPAINT, "Inpaint", NODE_CLASS_OP_FILTER, 0); + cmp_node_type_base(&ntype, CMP_NODE_INPAINT, "Inpaint", NODE_CLASS_OP_FILTER); ntype.declare = blender::nodes::cmp_node_inpaint_declare; ntype.draw_buttons = node_composit_buts_inpaint; diff --git a/source/blender/nodes/composite/nodes/node_composite_invert.cc b/source/blender/nodes/composite/nodes/node_composite_invert.cc index 2243608d5c3..c149e943c6d 100644 --- a/source/blender/nodes/composite/nodes/node_composite_invert.cc +++ b/source/blender/nodes/composite/nodes/node_composite_invert.cc @@ -58,7 +58,7 @@ void register_node_type_cmp_invert() { static bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_INVERT, "Invert", NODE_CLASS_OP_COLOR, 0); + cmp_node_type_base(&ntype, CMP_NODE_INVERT, "Invert", NODE_CLASS_OP_COLOR); ntype.declare = blender::nodes::cmp_node_invert_declare; ntype.draw_buttons = node_composit_buts_invert; node_type_init(&ntype, node_composit_init_invert); diff --git a/source/blender/nodes/composite/nodes/node_composite_keying.cc b/source/blender/nodes/composite/nodes/node_composite_keying.cc index e9daa84491a..0d392f65f3f 100644 --- a/source/blender/nodes/composite/nodes/node_composite_keying.cc +++ b/source/blender/nodes/composite/nodes/node_composite_keying.cc @@ -85,7 +85,7 @@ void register_node_type_cmp_keying() { static bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_KEYING, "Keying", NODE_CLASS_MATTE, 0); + cmp_node_type_base(&ntype, CMP_NODE_KEYING, "Keying", NODE_CLASS_MATTE); ntype.declare = blender::nodes::cmp_node_keying_declare; ntype.draw_buttons = node_composit_buts_keying; node_type_init(&ntype, node_composit_init_keying); diff --git a/source/blender/nodes/composite/nodes/node_composite_keyingscreen.cc b/source/blender/nodes/composite/nodes/node_composite_keyingscreen.cc index 31c505f3c0b..785a904d1fa 100644 --- a/source/blender/nodes/composite/nodes/node_composite_keyingscreen.cc +++ b/source/blender/nodes/composite/nodes/node_composite_keyingscreen.cc @@ -81,7 +81,7 @@ void register_node_type_cmp_keyingscreen() { static bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_KEYINGSCREEN, "Keying Screen", NODE_CLASS_MATTE, 0); + cmp_node_type_base(&ntype, CMP_NODE_KEYINGSCREEN, "Keying Screen", NODE_CLASS_MATTE); ntype.declare = blender::nodes::cmp_node_keyingscreen_declare; ntype.draw_buttons = node_composit_buts_keyingscreen; node_type_init(&ntype, node_composit_init_keyingscreen); diff --git a/source/blender/nodes/composite/nodes/node_composite_lensdist.cc b/source/blender/nodes/composite/nodes/node_composite_lensdist.cc index ce8f9e8fa2e..de8dea9947c 100644 --- a/source/blender/nodes/composite/nodes/node_composite_lensdist.cc +++ b/source/blender/nodes/composite/nodes/node_composite_lensdist.cc @@ -64,7 +64,7 @@ void register_node_type_cmp_lensdist() { static bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_LENSDIST, "Lens Distortion", NODE_CLASS_DISTORT, 0); + cmp_node_type_base(&ntype, CMP_NODE_LENSDIST, "Lens Distortion", NODE_CLASS_DISTORT); ntype.declare = blender::nodes::cmp_node_lensdist_declare; ntype.draw_buttons = node_composit_buts_lensdist; node_type_init(&ntype, node_composit_init_lensdist); diff --git a/source/blender/nodes/composite/nodes/node_composite_levels.cc b/source/blender/nodes/composite/nodes/node_composite_levels.cc index 891f79f9bf9..817de75ef55 100644 --- a/source/blender/nodes/composite/nodes/node_composite_levels.cc +++ b/source/blender/nodes/composite/nodes/node_composite_levels.cc @@ -53,9 +53,10 @@ void register_node_type_cmp_view_levels() { static bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_VIEW_LEVELS, "Levels", NODE_CLASS_OUTPUT, NODE_PREVIEW); + cmp_node_type_base(&ntype, CMP_NODE_VIEW_LEVELS, "Levels", NODE_CLASS_OUTPUT); ntype.declare = blender::nodes::cmp_node_levels_declare; ntype.draw_buttons = node_composit_buts_view_levels; + ntype.flag |= NODE_PREVIEW; node_type_init(&ntype, node_composit_init_view_levels); nodeRegisterType(&ntype); diff --git a/source/blender/nodes/composite/nodes/node_composite_lummaMatte.cc b/source/blender/nodes/composite/nodes/node_composite_lummaMatte.cc index 68758b08988..313bbf73955 100644 --- a/source/blender/nodes/composite/nodes/node_composite_lummaMatte.cc +++ b/source/blender/nodes/composite/nodes/node_composite_lummaMatte.cc @@ -62,9 +62,10 @@ void register_node_type_cmp_luma_matte() { static bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_LUMA_MATTE, "Luminance Key", NODE_CLASS_MATTE, NODE_PREVIEW); + cmp_node_type_base(&ntype, CMP_NODE_LUMA_MATTE, "Luminance Key", NODE_CLASS_MATTE); ntype.declare = blender::nodes::cmp_node_luma_matte_declare; ntype.draw_buttons = node_composit_buts_luma_matte; + ntype.flag |= NODE_PREVIEW; node_type_init(&ntype, node_composit_init_luma_matte); node_type_storage(&ntype, "NodeChroma", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/composite/nodes/node_composite_mapRange.cc b/source/blender/nodes/composite/nodes/node_composite_mapRange.cc index 1ae80f68dfd..3d90c050fa7 100644 --- a/source/blender/nodes/composite/nodes/node_composite_mapRange.cc +++ b/source/blender/nodes/composite/nodes/node_composite_mapRange.cc @@ -54,7 +54,7 @@ void register_node_type_cmp_map_range() { static bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_MAP_RANGE, "Map Range", NODE_CLASS_OP_VECTOR, 0); + cmp_node_type_base(&ntype, CMP_NODE_MAP_RANGE, "Map Range", NODE_CLASS_OP_VECTOR); ntype.declare = blender::nodes::cmp_node_map_range_declare; ntype.draw_buttons = node_composit_buts_map_range; diff --git a/source/blender/nodes/composite/nodes/node_composite_mapUV.cc b/source/blender/nodes/composite/nodes/node_composite_mapUV.cc index 71446e3a3c4..924a17d5c0b 100644 --- a/source/blender/nodes/composite/nodes/node_composite_mapUV.cc +++ b/source/blender/nodes/composite/nodes/node_composite_mapUV.cc @@ -48,7 +48,7 @@ void register_node_type_cmp_mapuv() { static bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_MAP_UV, "Map UV", NODE_CLASS_DISTORT, 0); + cmp_node_type_base(&ntype, CMP_NODE_MAP_UV, "Map UV", NODE_CLASS_DISTORT); ntype.declare = blender::nodes::cmp_node_map_uv_declare; ntype.draw_buttons = node_composit_buts_map_uv; diff --git a/source/blender/nodes/composite/nodes/node_composite_mapValue.cc b/source/blender/nodes/composite/nodes/node_composite_mapValue.cc index 4bd9124fa68..b94ea676ca0 100644 --- a/source/blender/nodes/composite/nodes/node_composite_mapValue.cc +++ b/source/blender/nodes/composite/nodes/node_composite_mapValue.cc @@ -70,7 +70,7 @@ void register_node_type_cmp_map_value() { static bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_MAP_VALUE, "Map Value", NODE_CLASS_OP_VECTOR, 0); + cmp_node_type_base(&ntype, CMP_NODE_MAP_VALUE, "Map Value", NODE_CLASS_OP_VECTOR); ntype.declare = blender::nodes::cmp_node_map_value_declare; ntype.draw_buttons = node_composit_buts_map_value; node_type_init(&ntype, node_composit_init_map_value); diff --git a/source/blender/nodes/composite/nodes/node_composite_mask.cc b/source/blender/nodes/composite/nodes/node_composite_mask.cc index b9e95af2532..0fea7148a4d 100644 --- a/source/blender/nodes/composite/nodes/node_composite_mask.cc +++ b/source/blender/nodes/composite/nodes/node_composite_mask.cc @@ -96,7 +96,7 @@ void register_node_type_cmp_mask() { static bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_MASK, "Mask", NODE_CLASS_INPUT, 0); + cmp_node_type_base(&ntype, CMP_NODE_MASK, "Mask", NODE_CLASS_INPUT); ntype.declare = blender::nodes::cmp_node_mask_declare; ntype.draw_buttons = node_composit_buts_mask; node_type_init(&ntype, node_composit_init_mask); diff --git a/source/blender/nodes/composite/nodes/node_composite_math.cc b/source/blender/nodes/composite/nodes/node_composite_math.cc index b34cfab5eb5..21d76756e0e 100644 --- a/source/blender/nodes/composite/nodes/node_composite_math.cc +++ b/source/blender/nodes/composite/nodes/node_composite_math.cc @@ -47,7 +47,7 @@ void register_node_type_cmp_math() { static bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_MATH, "Math", NODE_CLASS_CONVERTER, 0); + cmp_node_type_base(&ntype, CMP_NODE_MATH, "Math", NODE_CLASS_CONVERTER); ntype.declare = blender::nodes::cmp_node_math_declare; ntype.labelfunc = node_math_label; node_type_update(&ntype, node_math_update); diff --git a/source/blender/nodes/composite/nodes/node_composite_mixrgb.cc b/source/blender/nodes/composite/nodes/node_composite_mixrgb.cc index 4432b031ee7..7bc37fd5024 100644 --- a/source/blender/nodes/composite/nodes/node_composite_mixrgb.cc +++ b/source/blender/nodes/composite/nodes/node_composite_mixrgb.cc @@ -42,7 +42,8 @@ void register_node_type_cmp_mix_rgb() { static bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_MIX_RGB, "Mix", NODE_CLASS_OP_COLOR, NODE_PREVIEW); + cmp_node_type_base(&ntype, CMP_NODE_MIX_RGB, "Mix", NODE_CLASS_OP_COLOR); + ntype.flag |= NODE_PREVIEW; ntype.declare = blender::nodes::cmp_node_mixrgb_declare; ntype.labelfunc = node_blend_label; diff --git a/source/blender/nodes/composite/nodes/node_composite_movieclip.cc b/source/blender/nodes/composite/nodes/node_composite_movieclip.cc index 09c4c705149..3c0be471564 100644 --- a/source/blender/nodes/composite/nodes/node_composite_movieclip.cc +++ b/source/blender/nodes/composite/nodes/node_composite_movieclip.cc @@ -100,11 +100,12 @@ void register_node_type_cmp_movieclip() { static bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_MOVIECLIP, "Movie Clip", NODE_CLASS_INPUT, NODE_PREVIEW); + cmp_node_type_base(&ntype, CMP_NODE_MOVIECLIP, "Movie Clip", NODE_CLASS_INPUT); ntype.declare = blender::nodes::cmp_node_movieclip_declare; ntype.draw_buttons = node_composit_buts_movieclip; ntype.draw_buttons_ex = node_composit_buts_movieclip_ex; ntype.initfunc_api = init; + ntype.flag |= NODE_PREVIEW; node_type_storage( &ntype, "MovieClipUser", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/composite/nodes/node_composite_moviedistortion.cc b/source/blender/nodes/composite/nodes/node_composite_moviedistortion.cc index e7d9cac7c1a..17c9fd29b1d 100644 --- a/source/blender/nodes/composite/nodes/node_composite_moviedistortion.cc +++ b/source/blender/nodes/composite/nodes/node_composite_moviedistortion.cc @@ -102,7 +102,7 @@ void register_node_type_cmp_moviedistortion() { static bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_MOVIEDISTORTION, "Movie Distortion", NODE_CLASS_DISTORT, 0); + cmp_node_type_base(&ntype, CMP_NODE_MOVIEDISTORTION, "Movie Distortion", NODE_CLASS_DISTORT); ntype.declare = blender::nodes::cmp_node_moviedistortion_declare; ntype.draw_buttons = node_composit_buts_moviedistortion; ntype.labelfunc = label; diff --git a/source/blender/nodes/composite/nodes/node_composite_normal.cc b/source/blender/nodes/composite/nodes/node_composite_normal.cc index b541761a8cc..c84e02967b8 100644 --- a/source/blender/nodes/composite/nodes/node_composite_normal.cc +++ b/source/blender/nodes/composite/nodes/node_composite_normal.cc @@ -44,7 +44,7 @@ void register_node_type_cmp_normal() { static bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_NORMAL, "Normal", NODE_CLASS_OP_VECTOR, 0); + cmp_node_type_base(&ntype, CMP_NODE_NORMAL, "Normal", NODE_CLASS_OP_VECTOR); ntype.declare = blender::nodes::cmp_node_normal_declare; nodeRegisterType(&ntype); diff --git a/source/blender/nodes/composite/nodes/node_composite_normalize.cc b/source/blender/nodes/composite/nodes/node_composite_normalize.cc index dd3939fa6e2..e89af5fb9fb 100644 --- a/source/blender/nodes/composite/nodes/node_composite_normalize.cc +++ b/source/blender/nodes/composite/nodes/node_composite_normalize.cc @@ -39,7 +39,7 @@ void register_node_type_cmp_normalize() { static bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_NORMALIZE, "Normalize", NODE_CLASS_OP_VECTOR, 0); + cmp_node_type_base(&ntype, CMP_NODE_NORMALIZE, "Normalize", NODE_CLASS_OP_VECTOR); ntype.declare = blender::nodes::cmp_node_normalize_declare; nodeRegisterType(&ntype); diff --git a/source/blender/nodes/composite/nodes/node_composite_outputFile.cc b/source/blender/nodes/composite/nodes/node_composite_outputFile.cc index 9bc30d7fd73..f4699ec02d0 100644 --- a/source/blender/nodes/composite/nodes/node_composite_outputFile.cc +++ b/source/blender/nodes/composite/nodes/node_composite_outputFile.cc @@ -439,11 +439,12 @@ void register_node_type_cmp_output_file() { static bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_OUTPUT_FILE, "File Output", NODE_CLASS_OUTPUT, NODE_PREVIEW); + cmp_node_type_base(&ntype, CMP_NODE_OUTPUT_FILE, "File Output", NODE_CLASS_OUTPUT); node_type_socket_templates(&ntype, nullptr, nullptr); ntype.draw_buttons = node_composit_buts_file_output; ntype.draw_buttons_ex = node_composit_buts_file_output_ex; ntype.initfunc_api = init_output_file; + ntype.flag |= NODE_PREVIEW; node_type_storage(&ntype, "NodeImageMultiFile", free_output_file, copy_output_file); node_type_update(&ntype, update_output_file); diff --git a/source/blender/nodes/composite/nodes/node_composite_pixelate.cc b/source/blender/nodes/composite/nodes/node_composite_pixelate.cc index 3679aada759..7fe4d84ed72 100644 --- a/source/blender/nodes/composite/nodes/node_composite_pixelate.cc +++ b/source/blender/nodes/composite/nodes/node_composite_pixelate.cc @@ -39,7 +39,7 @@ void register_node_type_cmp_pixelate() { static bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_PIXELATE, "Pixelate", NODE_CLASS_OP_FILTER, 0); + cmp_node_type_base(&ntype, CMP_NODE_PIXELATE, "Pixelate", NODE_CLASS_OP_FILTER); ntype.declare = blender::nodes::cmp_node_pixelate_declare; nodeRegisterType(&ntype); diff --git a/source/blender/nodes/composite/nodes/node_composite_planetrackdeform.cc b/source/blender/nodes/composite/nodes/node_composite_planetrackdeform.cc index 9b15581a017..4e5299d8b5f 100644 --- a/source/blender/nodes/composite/nodes/node_composite_planetrackdeform.cc +++ b/source/blender/nodes/composite/nodes/node_composite_planetrackdeform.cc @@ -100,8 +100,7 @@ void register_node_type_cmp_planetrackdeform() { static bNodeType ntype; - cmp_node_type_base( - &ntype, CMP_NODE_PLANETRACKDEFORM, "Plane Track Deform", NODE_CLASS_DISTORT, 0); + cmp_node_type_base(&ntype, CMP_NODE_PLANETRACKDEFORM, "Plane Track Deform", NODE_CLASS_DISTORT); ntype.declare = blender::nodes::cmp_node_planetrackdeform_declare; ntype.draw_buttons = node_composit_buts_planetrackdeform; node_type_init(&ntype, init); diff --git a/source/blender/nodes/composite/nodes/node_composite_posterize.cc b/source/blender/nodes/composite/nodes/node_composite_posterize.cc index 8437c72e76c..347901a6578 100644 --- a/source/blender/nodes/composite/nodes/node_composite_posterize.cc +++ b/source/blender/nodes/composite/nodes/node_composite_posterize.cc @@ -40,7 +40,7 @@ void register_node_type_cmp_posterize() { static bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_POSTERIZE, "Posterize", NODE_CLASS_OP_COLOR, 0); + cmp_node_type_base(&ntype, CMP_NODE_POSTERIZE, "Posterize", NODE_CLASS_OP_COLOR); ntype.declare = blender::nodes::cmp_node_posterize_declare; nodeRegisterType(&ntype); diff --git a/source/blender/nodes/composite/nodes/node_composite_premulkey.cc b/source/blender/nodes/composite/nodes/node_composite_premulkey.cc index a70adf68692..ad29d231b11 100644 --- a/source/blender/nodes/composite/nodes/node_composite_premulkey.cc +++ b/source/blender/nodes/composite/nodes/node_composite_premulkey.cc @@ -47,7 +47,7 @@ void register_node_type_cmp_premulkey() { static bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_PREMULKEY, "Alpha Convert", NODE_CLASS_CONVERTER, 0); + cmp_node_type_base(&ntype, CMP_NODE_PREMULKEY, "Alpha Convert", NODE_CLASS_CONVERTER); ntype.declare = blender::nodes::cmp_node_premulkey_declare; ntype.draw_buttons = node_composit_buts_premulkey; diff --git a/source/blender/nodes/composite/nodes/node_composite_rgb.cc b/source/blender/nodes/composite/nodes/node_composite_rgb.cc index 54f152d1cd0..b7db175e1b1 100644 --- a/source/blender/nodes/composite/nodes/node_composite_rgb.cc +++ b/source/blender/nodes/composite/nodes/node_composite_rgb.cc @@ -38,7 +38,7 @@ void register_node_type_cmp_rgb() { static bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_RGB, "RGB", NODE_CLASS_INPUT, 0); + cmp_node_type_base(&ntype, CMP_NODE_RGB, "RGB", NODE_CLASS_INPUT); ntype.declare = blender::nodes::cmp_node_rgb_declare; node_type_size_preset(&ntype, NODE_SIZE_SMALL); diff --git a/source/blender/nodes/composite/nodes/node_composite_rotate.cc b/source/blender/nodes/composite/nodes/node_composite_rotate.cc index cc1589a47ca..a147d81a344 100644 --- a/source/blender/nodes/composite/nodes/node_composite_rotate.cc +++ b/source/blender/nodes/composite/nodes/node_composite_rotate.cc @@ -57,7 +57,7 @@ void register_node_type_cmp_rotate() { static bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_ROTATE, "Rotate", NODE_CLASS_DISTORT, 0); + cmp_node_type_base(&ntype, CMP_NODE_ROTATE, "Rotate", NODE_CLASS_DISTORT); ntype.declare = blender::nodes::cmp_node_rotate_declare; ntype.draw_buttons = node_composit_buts_rotate; node_type_init(&ntype, node_composit_init_rotate); diff --git a/source/blender/nodes/composite/nodes/node_composite_scale.cc b/source/blender/nodes/composite/nodes/node_composite_scale.cc index 98c9f6619f4..1aecf63d049 100644 --- a/source/blender/nodes/composite/nodes/node_composite_scale.cc +++ b/source/blender/nodes/composite/nodes/node_composite_scale.cc @@ -77,7 +77,7 @@ void register_node_type_cmp_scale() { static bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_SCALE, "Scale", NODE_CLASS_DISTORT, 0); + cmp_node_type_base(&ntype, CMP_NODE_SCALE, "Scale", NODE_CLASS_DISTORT); ntype.declare = blender::nodes::cmp_node_scale_declare; ntype.draw_buttons = node_composit_buts_scale; node_type_update(&ntype, node_composite_update_scale); diff --git a/source/blender/nodes/composite/nodes/node_composite_sepcombHSVA.cc b/source/blender/nodes/composite/nodes/node_composite_sepcombHSVA.cc index 9eafc0e3594..45db11d26b7 100644 --- a/source/blender/nodes/composite/nodes/node_composite_sepcombHSVA.cc +++ b/source/blender/nodes/composite/nodes/node_composite_sepcombHSVA.cc @@ -42,7 +42,7 @@ void register_node_type_cmp_sephsva() { static bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_SEPHSVA, "Separate HSVA", NODE_CLASS_CONVERTER, 0); + cmp_node_type_base(&ntype, CMP_NODE_SEPHSVA, "Separate HSVA", NODE_CLASS_CONVERTER); ntype.declare = blender::nodes::cmp_node_sephsva_declare; nodeRegisterType(&ntype); } @@ -66,7 +66,7 @@ void register_node_type_cmp_combhsva() { static bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_COMBHSVA, "Combine HSVA", NODE_CLASS_CONVERTER, 0); + cmp_node_type_base(&ntype, CMP_NODE_COMBHSVA, "Combine HSVA", NODE_CLASS_CONVERTER); ntype.declare = blender::nodes::cmp_node_combhsva_declare; nodeRegisterType(&ntype); diff --git a/source/blender/nodes/composite/nodes/node_composite_sepcombRGBA.cc b/source/blender/nodes/composite/nodes/node_composite_sepcombRGBA.cc index e81ea6f31be..0d4584f2d60 100644 --- a/source/blender/nodes/composite/nodes/node_composite_sepcombRGBA.cc +++ b/source/blender/nodes/composite/nodes/node_composite_sepcombRGBA.cc @@ -41,7 +41,7 @@ void register_node_type_cmp_seprgba() { static bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_SEPRGBA, "Separate RGBA", NODE_CLASS_CONVERTER, 0); + cmp_node_type_base(&ntype, CMP_NODE_SEPRGBA, "Separate RGBA", NODE_CLASS_CONVERTER); ntype.declare = blender::nodes::cmp_node_seprgba_declare; nodeRegisterType(&ntype); @@ -66,7 +66,7 @@ void register_node_type_cmp_combrgba() { static bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_COMBRGBA, "Combine RGBA", NODE_CLASS_CONVERTER, 0); + cmp_node_type_base(&ntype, CMP_NODE_COMBRGBA, "Combine RGBA", NODE_CLASS_CONVERTER); ntype.declare = blender::nodes::cmp_node_combrgba_declare; nodeRegisterType(&ntype); diff --git a/source/blender/nodes/composite/nodes/node_composite_sepcombYCCA.cc b/source/blender/nodes/composite/nodes/node_composite_sepcombYCCA.cc index 15c8efc2ef8..73790499a58 100644 --- a/source/blender/nodes/composite/nodes/node_composite_sepcombYCCA.cc +++ b/source/blender/nodes/composite/nodes/node_composite_sepcombYCCA.cc @@ -47,7 +47,7 @@ void register_node_type_cmp_sepycca() { static bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_SEPYCCA, "Separate YCbCrA", NODE_CLASS_CONVERTER, 0); + cmp_node_type_base(&ntype, CMP_NODE_SEPYCCA, "Separate YCbCrA", NODE_CLASS_CONVERTER); ntype.declare = blender::nodes::cmp_node_sepycca_declare; node_type_init(&ntype, node_composit_init_mode_sepycca); @@ -78,7 +78,7 @@ void register_node_type_cmp_combycca() { static bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_COMBYCCA, "Combine YCbCrA", NODE_CLASS_CONVERTER, 0); + cmp_node_type_base(&ntype, CMP_NODE_COMBYCCA, "Combine YCbCrA", NODE_CLASS_CONVERTER); ntype.declare = blender::nodes::cmp_node_combycca_declare; node_type_init(&ntype, node_composit_init_mode_combycca); diff --git a/source/blender/nodes/composite/nodes/node_composite_sepcombYUVA.cc b/source/blender/nodes/composite/nodes/node_composite_sepcombYUVA.cc index 4d4b01c2fb3..c026244d13b 100644 --- a/source/blender/nodes/composite/nodes/node_composite_sepcombYUVA.cc +++ b/source/blender/nodes/composite/nodes/node_composite_sepcombYUVA.cc @@ -42,7 +42,7 @@ void register_node_type_cmp_sepyuva() { static bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_SEPYUVA, "Separate YUVA", NODE_CLASS_CONVERTER, 0); + cmp_node_type_base(&ntype, CMP_NODE_SEPYUVA, "Separate YUVA", NODE_CLASS_CONVERTER); ntype.declare = blender::nodes::cmp_node_sepyuva_declare; nodeRegisterType(&ntype); @@ -67,7 +67,7 @@ void register_node_type_cmp_combyuva() { static bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_COMBYUVA, "Combine YUVA", NODE_CLASS_CONVERTER, 0); + cmp_node_type_base(&ntype, CMP_NODE_COMBYUVA, "Combine YUVA", NODE_CLASS_CONVERTER); ntype.declare = blender::nodes::cmp_node_combyuva_declare; nodeRegisterType(&ntype); diff --git a/source/blender/nodes/composite/nodes/node_composite_setalpha.cc b/source/blender/nodes/composite/nodes/node_composite_setalpha.cc index be47ed7df7e..8912e793a1d 100644 --- a/source/blender/nodes/composite/nodes/node_composite_setalpha.cc +++ b/source/blender/nodes/composite/nodes/node_composite_setalpha.cc @@ -55,7 +55,7 @@ void register_node_type_cmp_setalpha() { static bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_SETALPHA, "Set Alpha", NODE_CLASS_CONVERTER, 0); + cmp_node_type_base(&ntype, CMP_NODE_SETALPHA, "Set Alpha", NODE_CLASS_CONVERTER); ntype.declare = blender::nodes::cmp_node_setalpha_declare; ntype.draw_buttons = node_composit_buts_set_alpha; node_type_init(&ntype, node_composit_init_setalpha); diff --git a/source/blender/nodes/composite/nodes/node_composite_splitViewer.cc b/source/blender/nodes/composite/nodes/node_composite_splitViewer.cc index 0a449d95576..2ff64c3d735 100644 --- a/source/blender/nodes/composite/nodes/node_composite_splitViewer.cc +++ b/source/blender/nodes/composite/nodes/node_composite_splitViewer.cc @@ -65,10 +65,10 @@ void register_node_type_cmp_splitviewer() { static bNodeType ntype; - cmp_node_type_base( - &ntype, CMP_NODE_SPLITVIEWER, "Split Viewer", NODE_CLASS_OUTPUT, NODE_PREVIEW); + cmp_node_type_base(&ntype, CMP_NODE_SPLITVIEWER, "Split Viewer", NODE_CLASS_OUTPUT); ntype.declare = blender::nodes::cmp_node_split_viewer_declare; ntype.draw_buttons = node_composit_buts_splitviewer; + ntype.flag |= NODE_PREVIEW; node_type_init(&ntype, node_composit_init_splitviewer); node_type_storage(&ntype, "ImageUser", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/composite/nodes/node_composite_stabilize2d.cc b/source/blender/nodes/composite/nodes/node_composite_stabilize2d.cc index de6cc21ccd5..7ab933ab8ea 100644 --- a/source/blender/nodes/composite/nodes/node_composite_stabilize2d.cc +++ b/source/blender/nodes/composite/nodes/node_composite_stabilize2d.cc @@ -80,7 +80,7 @@ void register_node_type_cmp_stabilize2d() { static bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_STABILIZE2D, "Stabilize 2D", NODE_CLASS_DISTORT, 0); + cmp_node_type_base(&ntype, CMP_NODE_STABILIZE2D, "Stabilize 2D", NODE_CLASS_DISTORT); ntype.declare = blender::nodes::cmp_node_stabilize2d_declare; ntype.draw_buttons = node_composit_buts_stabilize2d; ntype.initfunc_api = init; diff --git a/source/blender/nodes/composite/nodes/node_composite_sunbeams.cc b/source/blender/nodes/composite/nodes/node_composite_sunbeams.cc index 462cc4b9961..7ae9d927a81 100644 --- a/source/blender/nodes/composite/nodes/node_composite_sunbeams.cc +++ b/source/blender/nodes/composite/nodes/node_composite_sunbeams.cc @@ -60,7 +60,7 @@ void register_node_type_cmp_sunbeams() { static bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_SUNBEAMS, "Sun Beams", NODE_CLASS_OP_FILTER, 0); + cmp_node_type_base(&ntype, CMP_NODE_SUNBEAMS, "Sun Beams", NODE_CLASS_OP_FILTER); ntype.declare = blender::nodes::cmp_node_sunbeams_declare; ntype.draw_buttons = node_composit_buts_sunbeams; node_type_init(&ntype, init); diff --git a/source/blender/nodes/composite/nodes/node_composite_switch.cc b/source/blender/nodes/composite/nodes/node_composite_switch.cc index d13bcc28d10..9392b7a1404 100644 --- a/source/blender/nodes/composite/nodes/node_composite_switch.cc +++ b/source/blender/nodes/composite/nodes/node_composite_switch.cc @@ -49,7 +49,7 @@ void register_node_type_cmp_switch() { static bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_SWITCH, "Switch", NODE_CLASS_LAYOUT, 0); + cmp_node_type_base(&ntype, CMP_NODE_SWITCH, "Switch", NODE_CLASS_LAYOUT); ntype.declare = blender::nodes::cmp_node_switch_declare; ntype.draw_buttons = node_composit_buts_switch; node_type_size_preset(&ntype, NODE_SIZE_SMALL); diff --git a/source/blender/nodes/composite/nodes/node_composite_switchview.cc b/source/blender/nodes/composite/nodes/node_composite_switchview.cc index 159d66fc6cc..2219333a8fe 100644 --- a/source/blender/nodes/composite/nodes/node_composite_switchview.cc +++ b/source/blender/nodes/composite/nodes/node_composite_switchview.cc @@ -159,7 +159,7 @@ void register_node_type_cmp_switch_view() { static bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_SWITCH_VIEW, "Switch View", NODE_CLASS_CONVERTER, 0); + cmp_node_type_base(&ntype, CMP_NODE_SWITCH_VIEW, "Switch View", NODE_CLASS_CONVERTER); node_type_socket_templates(&ntype, nullptr, cmp_node_switch_view_out); ntype.draw_buttons_ex = node_composit_buts_switch_view_ex; ntype.initfunc_api = init_switch_view; diff --git a/source/blender/nodes/composite/nodes/node_composite_texture.cc b/source/blender/nodes/composite/nodes/node_composite_texture.cc index 5e5fca755b2..67bf95c5ae9 100644 --- a/source/blender/nodes/composite/nodes/node_composite_texture.cc +++ b/source/blender/nodes/composite/nodes/node_composite_texture.cc @@ -45,8 +45,9 @@ void register_node_type_cmp_texture() { static bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_TEXTURE, "Texture", NODE_CLASS_INPUT, NODE_PREVIEW); + cmp_node_type_base(&ntype, CMP_NODE_TEXTURE, "Texture", NODE_CLASS_INPUT); ntype.declare = blender::nodes::cmp_node_texture_declare; + ntype.flag |= NODE_PREVIEW; nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/composite/nodes/node_composite_tonemap.cc b/source/blender/nodes/composite/nodes/node_composite_tonemap.cc index 9497f4486a6..fccfa6a3de9 100644 --- a/source/blender/nodes/composite/nodes/node_composite_tonemap.cc +++ b/source/blender/nodes/composite/nodes/node_composite_tonemap.cc @@ -80,7 +80,7 @@ void register_node_type_cmp_tonemap() { static bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_TONEMAP, "Tonemap", NODE_CLASS_OP_COLOR, 0); + cmp_node_type_base(&ntype, CMP_NODE_TONEMAP, "Tonemap", NODE_CLASS_OP_COLOR); ntype.declare = blender::nodes::cmp_node_tonemap_declare; ntype.draw_buttons = node_composit_buts_tonemap; node_type_init(&ntype, node_composit_init_tonemap); diff --git a/source/blender/nodes/composite/nodes/node_composite_trackpos.cc b/source/blender/nodes/composite/nodes/node_composite_trackpos.cc index dde03e3a484..cce3052ef22 100644 --- a/source/blender/nodes/composite/nodes/node_composite_trackpos.cc +++ b/source/blender/nodes/composite/nodes/node_composite_trackpos.cc @@ -98,7 +98,7 @@ void register_node_type_cmp_trackpos() { static bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_TRACKPOS, "Track Position", NODE_CLASS_INPUT, 0); + cmp_node_type_base(&ntype, CMP_NODE_TRACKPOS, "Track Position", NODE_CLASS_INPUT); ntype.declare = blender::nodes::cmp_node_trackpos_declare; ntype.draw_buttons = node_composit_buts_trackpos; node_type_init(&ntype, init); diff --git a/source/blender/nodes/composite/nodes/node_composite_transform.cc b/source/blender/nodes/composite/nodes/node_composite_transform.cc index ad1cc4cd308..ee9f25531f6 100644 --- a/source/blender/nodes/composite/nodes/node_composite_transform.cc +++ b/source/blender/nodes/composite/nodes/node_composite_transform.cc @@ -55,7 +55,7 @@ void register_node_type_cmp_transform() { static bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_TRANSFORM, "Transform", NODE_CLASS_DISTORT, 0); + cmp_node_type_base(&ntype, CMP_NODE_TRANSFORM, "Transform", NODE_CLASS_DISTORT); ntype.declare = blender::nodes::cmp_node_transform_declare; ntype.draw_buttons = node_composit_buts_transform; diff --git a/source/blender/nodes/composite/nodes/node_composite_translate.cc b/source/blender/nodes/composite/nodes/node_composite_translate.cc index df688b45f6c..96188b68496 100644 --- a/source/blender/nodes/composite/nodes/node_composite_translate.cc +++ b/source/blender/nodes/composite/nodes/node_composite_translate.cc @@ -56,7 +56,7 @@ void register_node_type_cmp_translate() { static bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_TRANSLATE, "Translate", NODE_CLASS_DISTORT, 0); + cmp_node_type_base(&ntype, CMP_NODE_TRANSLATE, "Translate", NODE_CLASS_DISTORT); ntype.declare = blender::nodes::cmp_node_translate_declare; ntype.draw_buttons = node_composit_buts_translate; node_type_init(&ntype, node_composit_init_translate); diff --git a/source/blender/nodes/composite/nodes/node_composite_valToRgb.cc b/source/blender/nodes/composite/nodes/node_composite_valToRgb.cc index dca6c9c141c..65e28751ce2 100644 --- a/source/blender/nodes/composite/nodes/node_composite_valToRgb.cc +++ b/source/blender/nodes/composite/nodes/node_composite_valToRgb.cc @@ -45,7 +45,7 @@ void register_node_type_cmp_valtorgb() { static bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_VALTORGB, "ColorRamp", NODE_CLASS_CONVERTER, 0); + cmp_node_type_base(&ntype, CMP_NODE_VALTORGB, "ColorRamp", NODE_CLASS_CONVERTER); ntype.declare = blender::nodes::cmp_node_valtorgb_declare; node_type_size(&ntype, 240, 200, 320); node_type_init(&ntype, node_composit_init_valtorgb); @@ -70,7 +70,7 @@ void register_node_type_cmp_rgbtobw() { static bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_RGBTOBW, "RGB to BW", NODE_CLASS_CONVERTER, 0); + cmp_node_type_base(&ntype, CMP_NODE_RGBTOBW, "RGB to BW", NODE_CLASS_CONVERTER); ntype.declare = blender::nodes::cmp_node_rgbtobw_declare; node_type_size_preset(&ntype, NODE_SIZE_SMALL); diff --git a/source/blender/nodes/composite/nodes/node_composite_value.cc b/source/blender/nodes/composite/nodes/node_composite_value.cc index d2274d2d82a..c78b0a454d9 100644 --- a/source/blender/nodes/composite/nodes/node_composite_value.cc +++ b/source/blender/nodes/composite/nodes/node_composite_value.cc @@ -38,7 +38,7 @@ void register_node_type_cmp_value() { static bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_VALUE, "Value", NODE_CLASS_INPUT, 0); + cmp_node_type_base(&ntype, CMP_NODE_VALUE, "Value", NODE_CLASS_INPUT); ntype.declare = blender::nodes::cmp_node_value_declare; node_type_size_preset(&ntype, NODE_SIZE_SMALL); diff --git a/source/blender/nodes/composite/nodes/node_composite_vecBlur.cc b/source/blender/nodes/composite/nodes/node_composite_vecBlur.cc index 9c9bb05a084..cef787a23b2 100644 --- a/source/blender/nodes/composite/nodes/node_composite_vecBlur.cc +++ b/source/blender/nodes/composite/nodes/node_composite_vecBlur.cc @@ -73,7 +73,7 @@ void register_node_type_cmp_vecblur() { static bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_VECBLUR, "Vector Blur", NODE_CLASS_OP_FILTER, 0); + cmp_node_type_base(&ntype, CMP_NODE_VECBLUR, "Vector Blur", NODE_CLASS_OP_FILTER); ntype.declare = blender::nodes::cmp_node_vec_blur_declare; ntype.draw_buttons = node_composit_buts_vecblur; node_type_init(&ntype, node_composit_init_vecblur); diff --git a/source/blender/nodes/composite/nodes/node_composite_viewer.cc b/source/blender/nodes/composite/nodes/node_composite_viewer.cc index 6cc6f822279..ba3d620a1aa 100644 --- a/source/blender/nodes/composite/nodes/node_composite_viewer.cc +++ b/source/blender/nodes/composite/nodes/node_composite_viewer.cc @@ -77,10 +77,11 @@ void register_node_type_cmp_viewer() { static bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_VIEWER, "Viewer", NODE_CLASS_OUTPUT, NODE_PREVIEW); + cmp_node_type_base(&ntype, CMP_NODE_VIEWER, "Viewer", NODE_CLASS_OUTPUT); ntype.declare = blender::nodes::cmp_node_viewer_declare; ntype.draw_buttons = node_composit_buts_viewer; ntype.draw_buttons_ex = node_composit_buts_viewer_ex; + ntype.flag |= NODE_PREVIEW; node_type_init(&ntype, node_composit_init_viewer); node_type_storage(&ntype, "ImageUser", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/composite/nodes/node_composite_zcombine.cc b/source/blender/nodes/composite/nodes/node_composite_zcombine.cc index dd6872e4dd9..d79b7aa5c14 100644 --- a/source/blender/nodes/composite/nodes/node_composite_zcombine.cc +++ b/source/blender/nodes/composite/nodes/node_composite_zcombine.cc @@ -55,7 +55,7 @@ void register_node_type_cmp_zcombine() { static bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_ZCOMBINE, "Z Combine", NODE_CLASS_OP_COLOR, 0); + cmp_node_type_base(&ntype, CMP_NODE_ZCOMBINE, "Z Combine", NODE_CLASS_OP_COLOR); ntype.declare = blender::nodes::cmp_node_zcombine_declare; ntype.draw_buttons = node_composit_buts_zcombine; diff --git a/source/blender/nodes/function/node_function_util.cc b/source/blender/nodes/function/node_function_util.cc index 83f5b571695..0137b298f45 100644 --- a/source/blender/nodes/function/node_function_util.cc +++ b/source/blender/nodes/function/node_function_util.cc @@ -31,9 +31,9 @@ static bool fn_node_poll_default(bNodeType *UNUSED(ntype), return true; } -void fn_node_type_base(bNodeType *ntype, int type, const char *name, short nclass, short flag) +void fn_node_type_base(bNodeType *ntype, int type, const char *name, short nclass) { - node_type_base(ntype, type, name, nclass, flag); + node_type_base(ntype, type, name, nclass); ntype->poll = fn_node_poll_default; ntype->insert_link = node_insert_link_default; ntype->gather_link_search_ops = blender::nodes::search_link_ops_for_basic_node; diff --git a/source/blender/nodes/function/node_function_util.hh b/source/blender/nodes/function/node_function_util.hh index 46b485298e3..acde9c4b55b 100644 --- a/source/blender/nodes/function/node_function_util.hh +++ b/source/blender/nodes/function/node_function_util.hh @@ -37,5 +37,4 @@ #include "FN_multi_function_builder.hh" -void fn_node_type_base( - struct bNodeType *ntype, int type, const char *name, short nclass, short flag); +void fn_node_type_base(struct bNodeType *ntype, int type, const char *name, short nclass); diff --git a/source/blender/nodes/function/nodes/legacy/node_fn_random_float.cc b/source/blender/nodes/function/nodes/legacy/node_fn_random_float.cc index 1ad34309bf2..582e6748a1e 100644 --- a/source/blender/nodes/function/nodes/legacy/node_fn_random_float.cc +++ b/source/blender/nodes/function/nodes/legacy/node_fn_random_float.cc @@ -81,7 +81,7 @@ void register_node_type_fn_legacy_random_float() static bNodeType ntype; - fn_node_type_base(&ntype, FN_NODE_LEGACY_RANDOM_FLOAT, "Random Float", 0, 0); + fn_node_type_base(&ntype, FN_NODE_LEGACY_RANDOM_FLOAT, "Random Float", 0); ntype.declare = file_ns::fn_node_legacy_random_float_declare; ntype.build_multi_function = file_ns::fn_node_legacy_random_float_build_multi_function; nodeRegisterType(&ntype); diff --git a/source/blender/nodes/function/nodes/node_fn_align_euler_to_vector.cc b/source/blender/nodes/function/nodes/node_fn_align_euler_to_vector.cc index a8436b96009..f4ce8d2f35a 100644 --- a/source/blender/nodes/function/nodes/node_fn_align_euler_to_vector.cc +++ b/source/blender/nodes/function/nodes/node_fn_align_euler_to_vector.cc @@ -216,7 +216,7 @@ void register_node_type_fn_align_euler_to_vector() static bNodeType ntype; fn_node_type_base( - &ntype, FN_NODE_ALIGN_EULER_TO_VECTOR, "Align Euler to Vector", NODE_CLASS_CONVERTER, 0); + &ntype, FN_NODE_ALIGN_EULER_TO_VECTOR, "Align Euler to Vector", NODE_CLASS_CONVERTER); ntype.declare = file_ns::fn_node_align_euler_to_vector_declare; ntype.draw_buttons = file_ns::fn_node_align_euler_to_vector_layout; ntype.build_multi_function = file_ns::fn_node_align_euler_to_vector_build_multi_function; diff --git a/source/blender/nodes/function/nodes/node_fn_boolean_math.cc b/source/blender/nodes/function/nodes/node_fn_boolean_math.cc index 45145958002..e8c05defe7c 100644 --- a/source/blender/nodes/function/nodes/node_fn_boolean_math.cc +++ b/source/blender/nodes/function/nodes/node_fn_boolean_math.cc @@ -95,7 +95,7 @@ void register_node_type_fn_boolean_math() static bNodeType ntype; - fn_node_type_base(&ntype, FN_NODE_BOOLEAN_MATH, "Boolean Math", NODE_CLASS_CONVERTER, 0); + fn_node_type_base(&ntype, FN_NODE_BOOLEAN_MATH, "Boolean Math", NODE_CLASS_CONVERTER); ntype.declare = file_ns::fn_node_boolean_math_declare; ntype.labelfunc = file_ns::node_boolean_math_label; node_type_update(&ntype, file_ns::node_boolean_math_update); diff --git a/source/blender/nodes/function/nodes/node_fn_compare.cc b/source/blender/nodes/function/nodes/node_fn_compare.cc index 0607acc95f2..28a6093e849 100644 --- a/source/blender/nodes/function/nodes/node_fn_compare.cc +++ b/source/blender/nodes/function/nodes/node_fn_compare.cc @@ -537,7 +537,7 @@ void register_node_type_fn_compare() namespace file_ns = blender::nodes::node_fn_compare_cc; static bNodeType ntype; - fn_node_type_base(&ntype, FN_NODE_COMPARE, "Compare", NODE_CLASS_CONVERTER, 0); + fn_node_type_base(&ntype, FN_NODE_COMPARE, "Compare", NODE_CLASS_CONVERTER); ntype.declare = file_ns::fn_node_compare_declare; ntype.labelfunc = file_ns::node_compare_label; node_type_update(&ntype, file_ns::node_compare_update); diff --git a/source/blender/nodes/function/nodes/node_fn_float_to_int.cc b/source/blender/nodes/function/nodes/node_fn_float_to_int.cc index 33b9f94ddcd..1a130e748d5 100644 --- a/source/blender/nodes/function/nodes/node_fn_float_to_int.cc +++ b/source/blender/nodes/function/nodes/node_fn_float_to_int.cc @@ -89,7 +89,7 @@ void register_node_type_fn_float_to_int() static bNodeType ntype; - fn_node_type_base(&ntype, FN_NODE_FLOAT_TO_INT, "Float to Integer", NODE_CLASS_CONVERTER, 0); + fn_node_type_base(&ntype, FN_NODE_FLOAT_TO_INT, "Float to Integer", NODE_CLASS_CONVERTER); ntype.declare = file_ns::fn_node_float_to_int_declare; ntype.labelfunc = file_ns::node_float_to_int_label; ntype.build_multi_function = file_ns::fn_node_float_to_int_build_multi_function; diff --git a/source/blender/nodes/function/nodes/node_fn_input_bool.cc b/source/blender/nodes/function/nodes/node_fn_input_bool.cc index edb18903b65..b6f7c802cc9 100644 --- a/source/blender/nodes/function/nodes/node_fn_input_bool.cc +++ b/source/blender/nodes/function/nodes/node_fn_input_bool.cc @@ -55,7 +55,7 @@ void register_node_type_fn_input_bool() static bNodeType ntype; - fn_node_type_base(&ntype, FN_NODE_INPUT_BOOL, "Boolean", 0, 0); + fn_node_type_base(&ntype, FN_NODE_INPUT_BOOL, "Boolean", 0); ntype.declare = file_ns::fn_node_input_bool_declare; node_type_init(&ntype, file_ns::fn_node_input_bool_init); node_type_storage( diff --git a/source/blender/nodes/function/nodes/node_fn_input_color.cc b/source/blender/nodes/function/nodes/node_fn_input_color.cc index 125df09b544..5ace57810e1 100644 --- a/source/blender/nodes/function/nodes/node_fn_input_color.cc +++ b/source/blender/nodes/function/nodes/node_fn_input_color.cc @@ -56,7 +56,7 @@ void register_node_type_fn_input_color() static bNodeType ntype; - fn_node_type_base(&ntype, FN_NODE_INPUT_COLOR, "Color", NODE_CLASS_INPUT, 0); + fn_node_type_base(&ntype, FN_NODE_INPUT_COLOR, "Color", NODE_CLASS_INPUT); ntype.declare = file_ns::fn_node_input_color_declare; node_type_init(&ntype, file_ns::fn_node_input_color_init); node_type_storage( diff --git a/source/blender/nodes/function/nodes/node_fn_input_int.cc b/source/blender/nodes/function/nodes/node_fn_input_int.cc index 4fecbf24248..d96339ae365 100644 --- a/source/blender/nodes/function/nodes/node_fn_input_int.cc +++ b/source/blender/nodes/function/nodes/node_fn_input_int.cc @@ -55,7 +55,7 @@ void register_node_type_fn_input_int() static bNodeType ntype; - fn_node_type_base(&ntype, FN_NODE_INPUT_INT, "Integer", 0, 0); + fn_node_type_base(&ntype, FN_NODE_INPUT_INT, "Integer", 0); ntype.declare = file_ns::fn_node_input_int_declare; node_type_init(&ntype, file_ns::fn_node_input_int_init); node_type_storage( diff --git a/source/blender/nodes/function/nodes/node_fn_input_special_characters.cc b/source/blender/nodes/function/nodes/node_fn_input_special_characters.cc index ebc071902e1..8137b424143 100644 --- a/source/blender/nodes/function/nodes/node_fn_input_special_characters.cc +++ b/source/blender/nodes/function/nodes/node_fn_input_special_characters.cc @@ -68,7 +68,7 @@ void register_node_type_fn_input_special_characters() static bNodeType ntype; fn_node_type_base( - &ntype, FN_NODE_INPUT_SPECIAL_CHARACTERS, "Special Characters", NODE_CLASS_INPUT, 0); + &ntype, FN_NODE_INPUT_SPECIAL_CHARACTERS, "Special Characters", NODE_CLASS_INPUT); ntype.declare = file_ns::fn_node_input_special_characters_declare; ntype.build_multi_function = file_ns::fn_node_input_special_characters_build_multi_function; nodeRegisterType(&ntype); diff --git a/source/blender/nodes/function/nodes/node_fn_input_string.cc b/source/blender/nodes/function/nodes/node_fn_input_string.cc index f3706575f39..a326caf50bd 100644 --- a/source/blender/nodes/function/nodes/node_fn_input_string.cc +++ b/source/blender/nodes/function/nodes/node_fn_input_string.cc @@ -79,7 +79,7 @@ void register_node_type_fn_input_string() static bNodeType ntype; - fn_node_type_base(&ntype, FN_NODE_INPUT_STRING, "String", NODE_CLASS_INPUT, 0); + fn_node_type_base(&ntype, FN_NODE_INPUT_STRING, "String", NODE_CLASS_INPUT); ntype.declare = file_ns::fn_node_input_string_declare; node_type_init(&ntype, file_ns::fn_node_input_string_init); node_type_storage( diff --git a/source/blender/nodes/function/nodes/node_fn_input_vector.cc b/source/blender/nodes/function/nodes/node_fn_input_vector.cc index c84ebda0d69..34515c4414c 100644 --- a/source/blender/nodes/function/nodes/node_fn_input_vector.cc +++ b/source/blender/nodes/function/nodes/node_fn_input_vector.cc @@ -56,7 +56,7 @@ void register_node_type_fn_input_vector() static bNodeType ntype; - fn_node_type_base(&ntype, FN_NODE_INPUT_VECTOR, "Vector", 0, 0); + fn_node_type_base(&ntype, FN_NODE_INPUT_VECTOR, "Vector", 0); ntype.declare = file_ns::fn_node_input_vector_declare; node_type_init(&ntype, file_ns::fn_node_input_vector_init); node_type_storage( diff --git a/source/blender/nodes/function/nodes/node_fn_random_value.cc b/source/blender/nodes/function/nodes/node_fn_random_value.cc index 12b56e9e4cd..c68af7e24af 100644 --- a/source/blender/nodes/function/nodes/node_fn_random_value.cc +++ b/source/blender/nodes/function/nodes/node_fn_random_value.cc @@ -346,7 +346,7 @@ void register_node_type_fn_random_value() static bNodeType ntype; - fn_node_type_base(&ntype, FN_NODE_RANDOM_VALUE, "Random Value", NODE_CLASS_CONVERTER, 0); + fn_node_type_base(&ntype, FN_NODE_RANDOM_VALUE, "Random Value", NODE_CLASS_CONVERTER); node_type_init(&ntype, file_ns::fn_node_random_value_init); node_type_update(&ntype, file_ns::fn_node_random_value_update); ntype.draw_buttons = file_ns::fn_node_random_value_layout; diff --git a/source/blender/nodes/function/nodes/node_fn_replace_string.cc b/source/blender/nodes/function/nodes/node_fn_replace_string.cc index 6e70686ae62..243cb63d713 100644 --- a/source/blender/nodes/function/nodes/node_fn_replace_string.cc +++ b/source/blender/nodes/function/nodes/node_fn_replace_string.cc @@ -61,7 +61,7 @@ void register_node_type_fn_replace_string() static bNodeType ntype; - fn_node_type_base(&ntype, FN_NODE_REPLACE_STRING, "Replace String", NODE_CLASS_CONVERTER, 0); + fn_node_type_base(&ntype, FN_NODE_REPLACE_STRING, "Replace String", NODE_CLASS_CONVERTER); ntype.declare = file_ns::fn_node_replace_string_declare; ntype.build_multi_function = file_ns::fn_node_replace_string_build_multi_function; nodeRegisterType(&ntype); diff --git a/source/blender/nodes/function/nodes/node_fn_rotate_euler.cc b/source/blender/nodes/function/nodes/node_fn_rotate_euler.cc index a9f464d9b73..582a9bb10a8 100644 --- a/source/blender/nodes/function/nodes/node_fn_rotate_euler.cc +++ b/source/blender/nodes/function/nodes/node_fn_rotate_euler.cc @@ -133,7 +133,7 @@ void register_node_type_fn_rotate_euler() static bNodeType ntype; - fn_node_type_base(&ntype, FN_NODE_ROTATE_EULER, "Rotate Euler", NODE_CLASS_CONVERTER, 0); + fn_node_type_base(&ntype, FN_NODE_ROTATE_EULER, "Rotate Euler", NODE_CLASS_CONVERTER); ntype.declare = file_ns::fn_node_rotate_euler_declare; ntype.draw_buttons = file_ns::fn_node_rotate_euler_layout; node_type_update(&ntype, file_ns::fn_node_rotate_euler_update); diff --git a/source/blender/nodes/function/nodes/node_fn_slice_string.cc b/source/blender/nodes/function/nodes/node_fn_slice_string.cc index 90dcfdc538c..f9d0af5ba9b 100644 --- a/source/blender/nodes/function/nodes/node_fn_slice_string.cc +++ b/source/blender/nodes/function/nodes/node_fn_slice_string.cc @@ -48,7 +48,7 @@ void register_node_type_fn_slice_string() static bNodeType ntype; - fn_node_type_base(&ntype, FN_NODE_SLICE_STRING, "Slice String", NODE_CLASS_CONVERTER, 0); + fn_node_type_base(&ntype, FN_NODE_SLICE_STRING, "Slice String", NODE_CLASS_CONVERTER); ntype.declare = file_ns::fn_node_slice_string_declare; ntype.build_multi_function = file_ns::fn_node_slice_string_build_multi_function; nodeRegisterType(&ntype); diff --git a/source/blender/nodes/function/nodes/node_fn_string_length.cc b/source/blender/nodes/function/nodes/node_fn_string_length.cc index 0878f6a31da..8ab56812125 100644 --- a/source/blender/nodes/function/nodes/node_fn_string_length.cc +++ b/source/blender/nodes/function/nodes/node_fn_string_length.cc @@ -43,7 +43,7 @@ void register_node_type_fn_string_length() static bNodeType ntype; - fn_node_type_base(&ntype, FN_NODE_STRING_LENGTH, "String Length", NODE_CLASS_CONVERTER, 0); + fn_node_type_base(&ntype, FN_NODE_STRING_LENGTH, "String Length", NODE_CLASS_CONVERTER); ntype.declare = file_ns::fn_node_string_length_declare; ntype.build_multi_function = file_ns::fn_node_string_length_build_multi_function; nodeRegisterType(&ntype); diff --git a/source/blender/nodes/function/nodes/node_fn_value_to_string.cc b/source/blender/nodes/function/nodes/node_fn_value_to_string.cc index af557c7b136..235c612dc15 100644 --- a/source/blender/nodes/function/nodes/node_fn_value_to_string.cc +++ b/source/blender/nodes/function/nodes/node_fn_value_to_string.cc @@ -45,7 +45,7 @@ void register_node_type_fn_value_to_string() static bNodeType ntype; - fn_node_type_base(&ntype, FN_NODE_VALUE_TO_STRING, "Value to String", NODE_CLASS_CONVERTER, 0); + fn_node_type_base(&ntype, FN_NODE_VALUE_TO_STRING, "Value to String", NODE_CLASS_CONVERTER); ntype.declare = file_ns::fn_node_value_to_string_declare; ntype.build_multi_function = file_ns::fn_node_value_to_string_build_multi_function; nodeRegisterType(&ntype); diff --git a/source/blender/nodes/geometry/CMakeLists.txt b/source/blender/nodes/geometry/CMakeLists.txt index 5d45fe9021a..e0c31fad97f 100644 --- a/source/blender/nodes/geometry/CMakeLists.txt +++ b/source/blender/nodes/geometry/CMakeLists.txt @@ -124,6 +124,7 @@ set(SRC nodes/node_geo_input_index.cc nodes/node_geo_input_material_index.cc nodes/node_geo_input_material.cc + nodes/node_geo_input_mesh_edge_angle.cc nodes/node_geo_input_mesh_edge_neighbors.cc nodes/node_geo_input_mesh_edge_vertices.cc nodes/node_geo_input_mesh_face_area.cc diff --git a/source/blender/nodes/geometry/node_geometry_util.cc b/source/blender/nodes/geometry/node_geometry_util.cc index 49991a40c1b..ceb9a7e1467 100644 --- a/source/blender/nodes/geometry/node_geometry_util.cc +++ b/source/blender/nodes/geometry/node_geometry_util.cc @@ -89,9 +89,9 @@ bool geo_node_poll_default(bNodeType *UNUSED(ntype), return true; } -void geo_node_type_base(bNodeType *ntype, int type, const char *name, short nclass, short flag) +void geo_node_type_base(bNodeType *ntype, int type, const char *name, short nclass) { - node_type_base(ntype, type, name, nclass, flag); + node_type_base(ntype, type, name, nclass); ntype->poll = geo_node_poll_default; ntype->insert_link = node_insert_link_default; ntype->gather_link_search_ops = blender::nodes::search_link_ops_for_basic_node; diff --git a/source/blender/nodes/geometry/node_geometry_util.hh b/source/blender/nodes/geometry/node_geometry_util.hh index 3376b75d05b..3a6c5e38f82 100644 --- a/source/blender/nodes/geometry/node_geometry_util.hh +++ b/source/blender/nodes/geometry/node_geometry_util.hh @@ -36,8 +36,7 @@ #include "node_util.h" -void geo_node_type_base( - struct bNodeType *ntype, int type, const char *name, short nclass, short flag); +void geo_node_type_base(struct bNodeType *ntype, int type, const char *name, short nclass); bool geo_node_poll_default(struct bNodeType *ntype, struct bNodeTree *ntree, const char **r_disabled_hint); diff --git a/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_align_rotation_to_vector.cc b/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_align_rotation_to_vector.cc index b4e1b671d15..36ad4605a4b 100644 --- a/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_align_rotation_to_vector.cc +++ b/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_align_rotation_to_vector.cc @@ -228,8 +228,7 @@ void register_node_type_geo_align_rotation_to_vector() geo_node_type_base(&ntype, GEO_NODE_LEGACY_ALIGN_ROTATION_TO_VECTOR, "Align Rotation to Vector", - NODE_CLASS_GEOMETRY, - 0); + NODE_CLASS_GEOMETRY); node_type_init(&ntype, file_ns::node_init); node_type_update(&ntype, file_ns::node_update); node_type_storage(&ntype, diff --git a/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_attribute_clamp.cc b/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_attribute_clamp.cc index a103709d284..cac2a90a76c 100644 --- a/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_attribute_clamp.cc +++ b/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_attribute_clamp.cc @@ -270,7 +270,7 @@ void register_node_type_geo_attribute_clamp() static bNodeType ntype; geo_node_type_base( - &ntype, GEO_NODE_LEGACY_ATTRIBUTE_CLAMP, "Attribute Clamp", NODE_CLASS_ATTRIBUTE, 0); + &ntype, GEO_NODE_LEGACY_ATTRIBUTE_CLAMP, "Attribute Clamp", NODE_CLASS_ATTRIBUTE); node_type_init(&ntype, file_ns::node_init); node_type_update(&ntype, file_ns::node_update); ntype.declare = file_ns::node_declare; diff --git a/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_attribute_color_ramp.cc b/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_attribute_color_ramp.cc index fe3fb872238..672dbfdbf86 100644 --- a/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_attribute_color_ramp.cc +++ b/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_attribute_color_ramp.cc @@ -124,11 +124,8 @@ void register_node_type_geo_attribute_color_ramp() static bNodeType ntype; - geo_node_type_base(&ntype, - GEO_NODE_LEGACY_ATTRIBUTE_COLOR_RAMP, - "Attribute Color Ramp", - NODE_CLASS_ATTRIBUTE, - 0); + geo_node_type_base( + &ntype, GEO_NODE_LEGACY_ATTRIBUTE_COLOR_RAMP, "Attribute Color Ramp", NODE_CLASS_ATTRIBUTE); node_type_storage( &ntype, "NodeAttributeColorRamp", node_free_standard_storage, node_copy_standard_storage); node_type_init(&ntype, file_ns::node_init); diff --git a/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_attribute_combine_xyz.cc b/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_attribute_combine_xyz.cc index 3065ea3d7a1..403b9446f75 100644 --- a/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_attribute_combine_xyz.cc +++ b/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_attribute_combine_xyz.cc @@ -138,8 +138,7 @@ void register_node_type_geo_attribute_combine_xyz() geo_node_type_base(&ntype, GEO_NODE_LEGACY_ATTRIBUTE_COMBINE_XYZ, "Attribute Combine XYZ", - NODE_CLASS_ATTRIBUTE, - 0); + NODE_CLASS_ATTRIBUTE); node_type_init(&ntype, file_ns::node_init); node_type_update(&ntype, file_ns::node_update); node_type_storage( diff --git a/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_attribute_compare.cc b/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_attribute_compare.cc index 3a973610cc4..6cec73d76a2 100644 --- a/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_attribute_compare.cc +++ b/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_attribute_compare.cc @@ -347,7 +347,7 @@ void register_node_type_geo_attribute_compare() static bNodeType ntype; geo_node_type_base( - &ntype, GEO_NODE_LEGACY_ATTRIBUTE_COMPARE, "Attribute Compare", NODE_CLASS_ATTRIBUTE, 0); + &ntype, GEO_NODE_LEGACY_ATTRIBUTE_COMPARE, "Attribute Compare", NODE_CLASS_ATTRIBUTE); ntype.declare = file_ns::node_declare; ntype.geometry_node_execute = file_ns::node_geo_exec; ntype.draw_buttons = file_ns::node_layout; diff --git a/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_attribute_convert.cc b/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_attribute_convert.cc index b729eec87f8..2b13f57e990 100644 --- a/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_attribute_convert.cc +++ b/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_attribute_convert.cc @@ -181,7 +181,7 @@ void register_node_type_geo_attribute_convert() static bNodeType ntype; geo_node_type_base( - &ntype, GEO_NODE_LEGACY_ATTRIBUTE_CONVERT, "Attribute Convert", NODE_CLASS_ATTRIBUTE, 0); + &ntype, GEO_NODE_LEGACY_ATTRIBUTE_CONVERT, "Attribute Convert", NODE_CLASS_ATTRIBUTE); ntype.declare = file_ns::node_declare; ntype.geometry_node_execute = file_ns::node_geo_exec; ntype.draw_buttons = file_ns::node_layout; diff --git a/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_attribute_curve_map.cc b/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_attribute_curve_map.cc index 4bef8f658a9..8e1e763f1ad 100644 --- a/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_attribute_curve_map.cc +++ b/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_attribute_curve_map.cc @@ -209,7 +209,7 @@ void register_node_type_geo_attribute_curve_map() static bNodeType ntype; geo_node_type_base( - &ntype, GEO_NODE_LEGACY_ATTRIBUTE_CURVE_MAP, "Attribute Curve Map", NODE_CLASS_ATTRIBUTE, 0); + &ntype, GEO_NODE_LEGACY_ATTRIBUTE_CURVE_MAP, "Attribute Curve Map", NODE_CLASS_ATTRIBUTE); node_type_update(&ntype, file_ns::node_update); node_type_init(&ntype, file_ns::node_init); node_type_size_preset(&ntype, NODE_SIZE_LARGE); diff --git a/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_attribute_fill.cc b/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_attribute_fill.cc index a05bcf1bed8..a32e3b7412f 100644 --- a/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_attribute_fill.cc +++ b/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_attribute_fill.cc @@ -155,7 +155,7 @@ void register_node_type_geo_attribute_fill() static bNodeType ntype; geo_node_type_base( - &ntype, GEO_NODE_LEGACY_ATTRIBUTE_FILL, "Attribute Fill", NODE_CLASS_ATTRIBUTE, 0); + &ntype, GEO_NODE_LEGACY_ATTRIBUTE_FILL, "Attribute Fill", NODE_CLASS_ATTRIBUTE); node_type_init(&ntype, file_ns::node_init); node_type_update(&ntype, file_ns::node_update); ntype.geometry_node_execute = file_ns::node_geo_exec; diff --git a/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_attribute_map_range.cc b/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_attribute_map_range.cc index 9bc1eaaa368..398af087499 100644 --- a/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_attribute_map_range.cc +++ b/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_attribute_map_range.cc @@ -424,7 +424,7 @@ void register_node_type_geo_attribute_map_range() static bNodeType ntype; geo_node_type_base( - &ntype, GEO_NODE_LEGACY_ATTRIBUTE_MAP_RANGE, "Attribute Map Range", NODE_CLASS_ATTRIBUTE, 0); + &ntype, GEO_NODE_LEGACY_ATTRIBUTE_MAP_RANGE, "Attribute Map Range", NODE_CLASS_ATTRIBUTE); ntype.geometry_node_execute = file_ns::node_geo_exec; node_type_init(&ntype, file_ns::node_init); node_type_update(&ntype, file_ns::node_update); diff --git a/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_attribute_math.cc b/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_attribute_math.cc index 3deaecad26d..3257d2d7358 100644 --- a/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_attribute_math.cc +++ b/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_attribute_math.cc @@ -309,7 +309,7 @@ void register_node_type_geo_attribute_math() static bNodeType ntype; geo_node_type_base( - &ntype, GEO_NODE_LEGACY_ATTRIBUTE_MATH, "Attribute Math", NODE_CLASS_ATTRIBUTE, 0); + &ntype, GEO_NODE_LEGACY_ATTRIBUTE_MATH, "Attribute Math", NODE_CLASS_ATTRIBUTE); ntype.declare = file_ns::node_declare; ntype.geometry_node_execute = file_ns::node_geo_exec; ntype.draw_buttons = file_ns::node_layout; diff --git a/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_attribute_mix.cc b/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_attribute_mix.cc index 20cc285f3a5..c0c30898584 100644 --- a/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_attribute_mix.cc +++ b/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_attribute_mix.cc @@ -247,8 +247,7 @@ void register_node_type_geo_attribute_mix() namespace file_ns = blender::nodes::node_geo_legacy_attribute_mix_cc; static bNodeType ntype; - geo_node_type_base( - &ntype, GEO_NODE_LEGACY_ATTRIBUTE_MIX, "Attribute Mix", NODE_CLASS_ATTRIBUTE, 0); + geo_node_type_base(&ntype, GEO_NODE_LEGACY_ATTRIBUTE_MIX, "Attribute Mix", NODE_CLASS_ATTRIBUTE); node_type_init(&ntype, file_ns::node_init); node_type_update(&ntype, file_ns::node_update); ntype.declare = file_ns::node_declare; diff --git a/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_attribute_proximity.cc b/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_attribute_proximity.cc index e1b7f9452f3..74dac73f255 100644 --- a/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_attribute_proximity.cc +++ b/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_attribute_proximity.cc @@ -237,7 +237,7 @@ void register_node_type_geo_legacy_attribute_proximity() static bNodeType ntype; geo_node_type_base( - &ntype, GEO_NODE_LEGACY_ATTRIBUTE_PROXIMITY, "Attribute Proximity", NODE_CLASS_ATTRIBUTE, 0); + &ntype, GEO_NODE_LEGACY_ATTRIBUTE_PROXIMITY, "Attribute Proximity", NODE_CLASS_ATTRIBUTE); node_type_init(&ntype, file_ns::node_init); node_type_storage(&ntype, "NodeGeometryAttributeProximity", diff --git a/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_attribute_randomize.cc b/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_attribute_randomize.cc index f0aa8361e6e..92a946b225b 100644 --- a/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_attribute_randomize.cc +++ b/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_attribute_randomize.cc @@ -334,7 +334,7 @@ void register_node_type_geo_legacy_attribute_randomize() static bNodeType ntype; geo_node_type_base( - &ntype, GEO_NODE_LEGACY_ATTRIBUTE_RANDOMIZE, "Attribute Randomize", NODE_CLASS_ATTRIBUTE, 0); + &ntype, GEO_NODE_LEGACY_ATTRIBUTE_RANDOMIZE, "Attribute Randomize", NODE_CLASS_ATTRIBUTE); node_type_init(&ntype, file_ns::node_init); node_type_update(&ntype, file_ns::node_update); diff --git a/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_attribute_sample_texture.cc b/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_attribute_sample_texture.cc index bc18cb32e73..ae034d152be 100644 --- a/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_attribute_sample_texture.cc +++ b/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_attribute_sample_texture.cc @@ -130,8 +130,7 @@ void register_node_type_geo_sample_texture() geo_node_type_base(&ntype, GEO_NODE_LEGACY_ATTRIBUTE_SAMPLE_TEXTURE, "Attribute Sample Texture", - NODE_CLASS_ATTRIBUTE, - 0); + NODE_CLASS_ATTRIBUTE); node_type_size_preset(&ntype, NODE_SIZE_LARGE); ntype.declare = file_ns::node_declare; ntype.geometry_node_execute = file_ns::node_geo_exec; diff --git a/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_attribute_separate_xyz.cc b/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_attribute_separate_xyz.cc index c30a9d3a7dd..960ec540556 100644 --- a/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_attribute_separate_xyz.cc +++ b/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_attribute_separate_xyz.cc @@ -159,8 +159,7 @@ void register_node_type_geo_attribute_separate_xyz() geo_node_type_base(&ntype, GEO_NODE_LEGACY_ATTRIBUTE_SEPARATE_XYZ, "Attribute Separate XYZ", - NODE_CLASS_ATTRIBUTE, - 0); + NODE_CLASS_ATTRIBUTE); ntype.declare = file_ns::node_declare; node_type_init(&ntype, file_ns::node_init); node_type_update(&ntype, file_ns::node_update); diff --git a/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_attribute_transfer.cc b/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_attribute_transfer.cc index 2552308a8c2..b0210f2eb94 100644 --- a/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_attribute_transfer.cc +++ b/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_attribute_transfer.cc @@ -516,7 +516,7 @@ void register_node_type_geo_legacy_attribute_transfer() static bNodeType ntype; geo_node_type_base( - &ntype, GEO_NODE_LEGACY_ATTRIBUTE_TRANSFER, "Attribute Transfer", NODE_CLASS_ATTRIBUTE, 0); + &ntype, GEO_NODE_LEGACY_ATTRIBUTE_TRANSFER, "Attribute Transfer", NODE_CLASS_ATTRIBUTE); node_type_init(&ntype, file_ns::node_init); node_type_storage(&ntype, "NodeGeometryAttributeTransfer", diff --git a/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_attribute_vector_math.cc b/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_attribute_vector_math.cc index c9e8ce88b25..5b3c3c05a6a 100644 --- a/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_attribute_vector_math.cc +++ b/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_attribute_vector_math.cc @@ -559,8 +559,7 @@ void register_node_type_geo_attribute_vector_math() geo_node_type_base(&ntype, GEO_NODE_LEGACY_ATTRIBUTE_VECTOR_MATH, "Attribute Vector Math", - NODE_CLASS_ATTRIBUTE, - 0); + NODE_CLASS_ATTRIBUTE); ntype.declare = file_ns::node_declare; ntype.geometry_node_execute = file_ns::node_geo_exec; ntype.draw_buttons = file_ns::node_layout; diff --git a/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_attribute_vector_rotate.cc b/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_attribute_vector_rotate.cc index bdc09eb3408..3738c4ad14d 100644 --- a/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_attribute_vector_rotate.cc +++ b/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_attribute_vector_rotate.cc @@ -336,8 +336,7 @@ void register_node_type_geo_attribute_vector_rotate() geo_node_type_base(&ntype, GEO_NODE_LEGACY_ATTRIBUTE_VECTOR_ROTATE, "Attribute Vector Rotate", - NODE_CLASS_ATTRIBUTE, - 0); + NODE_CLASS_ATTRIBUTE); node_type_update(&ntype, file_ns::node_update); node_type_init(&ntype, file_ns::node_init); node_type_size(&ntype, 165, 100, 600); diff --git a/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_curve_endpoints.cc b/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_curve_endpoints.cc index e61dee4bee1..51564d8d200 100644 --- a/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_curve_endpoints.cc +++ b/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_curve_endpoints.cc @@ -213,7 +213,7 @@ void register_node_type_geo_legacy_curve_endpoints() static bNodeType ntype; geo_node_type_base( - &ntype, GEO_NODE_LEGACY_CURVE_ENDPOINTS, "Curve Endpoints", NODE_CLASS_GEOMETRY, 0); + &ntype, GEO_NODE_LEGACY_CURVE_ENDPOINTS, "Curve Endpoints", NODE_CLASS_GEOMETRY); ntype.declare = file_ns::node_declare; ntype.geometry_node_execute = file_ns::node_geo_exec; diff --git a/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_curve_reverse.cc b/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_curve_reverse.cc index 7c550495b41..844baa53962 100644 --- a/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_curve_reverse.cc +++ b/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_curve_reverse.cc @@ -65,8 +65,7 @@ void register_node_type_geo_legacy_curve_reverse() namespace file_ns = blender::nodes::node_geo_legacy_curve_reverse_cc; static bNodeType ntype; - geo_node_type_base( - &ntype, GEO_NODE_LEGACY_CURVE_REVERSE, "Curve Reverse", NODE_CLASS_GEOMETRY, 0); + geo_node_type_base(&ntype, GEO_NODE_LEGACY_CURVE_REVERSE, "Curve Reverse", NODE_CLASS_GEOMETRY); ntype.declare = file_ns::node_declare; ntype.geometry_node_execute = file_ns::node_geo_exec; nodeRegisterType(&ntype); diff --git a/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_curve_select_by_handle_type.cc b/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_curve_select_by_handle_type.cc index e86b0f225e3..780756bcbca 100644 --- a/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_curve_select_by_handle_type.cc +++ b/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_curve_select_by_handle_type.cc @@ -126,11 +126,8 @@ void register_node_type_geo_legacy_select_by_handle_type() static bNodeType ntype; - geo_node_type_base(&ntype, - GEO_NODE_LEGACY_CURVE_SELECT_HANDLES, - "Select by Handle Type", - NODE_CLASS_GEOMETRY, - 0); + geo_node_type_base( + &ntype, GEO_NODE_LEGACY_CURVE_SELECT_HANDLES, "Select by Handle Type", NODE_CLASS_GEOMETRY); ntype.declare = file_ns::node_declare; ntype.geometry_node_execute = file_ns::node_geo_exec; node_type_init(&ntype, file_ns::node_init); diff --git a/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_curve_set_handles.cc b/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_curve_set_handles.cc index b4106e69bbd..a82b917e817 100644 --- a/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_curve_set_handles.cc +++ b/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_curve_set_handles.cc @@ -129,7 +129,7 @@ void register_node_type_geo_legacy_curve_set_handles() static bNodeType ntype; geo_node_type_base( - &ntype, GEO_NODE_LEGACY_CURVE_SET_HANDLES, "Set Handle Type", NODE_CLASS_GEOMETRY, 0); + &ntype, GEO_NODE_LEGACY_CURVE_SET_HANDLES, "Set Handle Type", NODE_CLASS_GEOMETRY); ntype.declare = file_ns::node_decalre; ntype.geometry_node_execute = file_ns::node_geo_exec; node_type_init(&ntype, file_ns::node_init); diff --git a/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_curve_spline_type.cc b/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_curve_spline_type.cc index cbd4e3b29f2..6fd82e6a1bb 100644 --- a/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_curve_spline_type.cc +++ b/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_curve_spline_type.cc @@ -287,7 +287,7 @@ void register_node_type_geo_legacy_curve_spline_type() static bNodeType ntype; geo_node_type_base( - &ntype, GEO_NODE_LEGACY_CURVE_SPLINE_TYPE, "Set Spline Type", NODE_CLASS_GEOMETRY, 0); + &ntype, GEO_NODE_LEGACY_CURVE_SPLINE_TYPE, "Set Spline Type", NODE_CLASS_GEOMETRY); ntype.declare = file_ns::node_declare; ntype.geometry_node_execute = file_ns::node_geo_exec; node_type_init(&ntype, file_ns::node_init); diff --git a/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_curve_subdivide.cc b/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_curve_subdivide.cc index e4db622ad52..4621a1656aa 100644 --- a/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_curve_subdivide.cc +++ b/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_curve_subdivide.cc @@ -378,7 +378,7 @@ void register_node_type_geo_legacy_curve_subdivide() static bNodeType ntype; geo_node_type_base( - &ntype, GEO_NODE_LEGACY_CURVE_SUBDIVIDE, "Curve Subdivide", NODE_CLASS_GEOMETRY, 0); + &ntype, GEO_NODE_LEGACY_CURVE_SUBDIVIDE, "Curve Subdivide", NODE_CLASS_GEOMETRY); ntype.declare = file_ns::node_declare; ntype.draw_buttons = file_ns::node_layout; node_type_storage(&ntype, diff --git a/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_curve_to_points.cc b/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_curve_to_points.cc index a5d135582eb..8555d7cc8a3 100644 --- a/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_curve_to_points.cc +++ b/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_curve_to_points.cc @@ -352,7 +352,7 @@ void register_node_type_geo_legacy_curve_to_points() static bNodeType ntype; geo_node_type_base( - &ntype, GEO_NODE_LEGACY_CURVE_TO_POINTS, "Curve to Points", NODE_CLASS_GEOMETRY, 0); + &ntype, GEO_NODE_LEGACY_CURVE_TO_POINTS, "Curve to Points", NODE_CLASS_GEOMETRY); ntype.declare = file_ns::node_declare; ntype.geometry_node_execute = file_ns::node_geo_exec; ntype.draw_buttons = file_ns::node_layout; diff --git a/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_delete_geometry.cc b/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_delete_geometry.cc index abd75e710ae..0953d05bc36 100644 --- a/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_delete_geometry.cc +++ b/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_delete_geometry.cc @@ -671,7 +671,7 @@ void register_node_type_geo_legacy_delete_geometry() static bNodeType ntype; geo_node_type_base( - &ntype, GEO_NODE_LEGACY_DELETE_GEOMETRY, "Delete Geometry", NODE_CLASS_GEOMETRY, 0); + &ntype, GEO_NODE_LEGACY_DELETE_GEOMETRY, "Delete Geometry", NODE_CLASS_GEOMETRY); ntype.declare = file_ns::node_declare; ntype.geometry_node_execute = file_ns::node_geo_exec; diff --git a/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_edge_split.cc b/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_edge_split.cc index c046fda4686..e628edb7e17 100644 --- a/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_edge_split.cc +++ b/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_edge_split.cc @@ -84,7 +84,7 @@ void register_node_type_geo_legacy_edge_split() static bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_LEGACY_EDGE_SPLIT, "Edge Split", NODE_CLASS_GEOMETRY, 0); + geo_node_type_base(&ntype, GEO_NODE_LEGACY_EDGE_SPLIT, "Edge Split", NODE_CLASS_GEOMETRY); ntype.geometry_node_execute = file_ns::node_geo_exec; ntype.declare = file_ns::node_declare; nodeRegisterType(&ntype); diff --git a/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_material_assign.cc b/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_material_assign.cc index 88e8374f5d6..8fd6b1e299f 100644 --- a/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_material_assign.cc +++ b/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_material_assign.cc @@ -90,7 +90,7 @@ void register_node_type_geo_legacy_material_assign() static bNodeType ntype; geo_node_type_base( - &ntype, GEO_NODE_LEGACY_MATERIAL_ASSIGN, "Material Assign", NODE_CLASS_GEOMETRY, 0); + &ntype, GEO_NODE_LEGACY_MATERIAL_ASSIGN, "Material Assign", NODE_CLASS_GEOMETRY); ntype.declare = file_ns::node_declare; ntype.geometry_node_execute = file_ns::node_geo_exec; nodeRegisterType(&ntype); diff --git a/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_mesh_to_curve.cc b/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_mesh_to_curve.cc index 2ff7410f3f6..d026fff003f 100644 --- a/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_mesh_to_curve.cc +++ b/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_mesh_to_curve.cc @@ -73,8 +73,7 @@ void register_node_type_geo_legacy_mesh_to_curve() static bNodeType ntype; - geo_node_type_base( - &ntype, GEO_NODE_LEGACY_MESH_TO_CURVE, "Mesh to Curve", NODE_CLASS_GEOMETRY, 0); + geo_node_type_base(&ntype, GEO_NODE_LEGACY_MESH_TO_CURVE, "Mesh to Curve", NODE_CLASS_GEOMETRY); ntype.declare = file_ns::node_declare; ntype.geometry_node_execute = file_ns::node_geo_exec; nodeRegisterType(&ntype); diff --git a/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_point_distribute.cc b/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_point_distribute.cc index 2451a7447ec..c712e82ca18 100644 --- a/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_point_distribute.cc +++ b/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_point_distribute.cc @@ -662,7 +662,7 @@ void register_node_type_geo_point_distribute() static bNodeType ntype; geo_node_type_base( - &ntype, GEO_NODE_LEGACY_POINT_DISTRIBUTE, "Point Distribute", NODE_CLASS_GEOMETRY, 0); + &ntype, GEO_NODE_LEGACY_POINT_DISTRIBUTE, "Point Distribute", NODE_CLASS_GEOMETRY); node_type_update(&ntype, file_ns::node_point_distribute_update); ntype.declare = file_ns::node_declare; ntype.geometry_node_execute = file_ns::node_geo_exec; diff --git a/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_point_instance.cc b/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_point_instance.cc index 61fea9fee11..faf0b1a5fe7 100644 --- a/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_point_instance.cc +++ b/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_point_instance.cc @@ -270,7 +270,7 @@ void register_node_type_geo_point_instance() static bNodeType ntype; geo_node_type_base( - &ntype, GEO_NODE_LEGACY_POINT_INSTANCE, "Point Instance", NODE_CLASS_GEOMETRY, 0); + &ntype, GEO_NODE_LEGACY_POINT_INSTANCE, "Point Instance", NODE_CLASS_GEOMETRY); node_type_init(&ntype, file_ns::node_init); node_type_storage( &ntype, "NodeGeometryPointInstance", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_point_rotate.cc b/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_point_rotate.cc index 26fae8093a5..ad87ec5541b 100644 --- a/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_point_rotate.cc +++ b/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_point_rotate.cc @@ -225,7 +225,7 @@ void register_node_type_geo_point_rotate() static bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_LEGACY_POINT_ROTATE, "Point Rotate", NODE_CLASS_GEOMETRY, 0); + geo_node_type_base(&ntype, GEO_NODE_LEGACY_POINT_ROTATE, "Point Rotate", NODE_CLASS_GEOMETRY); node_type_init(&ntype, file_ns::node_init); node_type_update(&ntype, file_ns::node_update); node_type_storage( diff --git a/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_point_scale.cc b/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_point_scale.cc index bf2db79515e..69e69a24e29 100644 --- a/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_point_scale.cc +++ b/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_point_scale.cc @@ -127,7 +127,7 @@ void register_node_type_geo_point_scale() static bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_LEGACY_POINT_SCALE, "Point Scale", NODE_CLASS_GEOMETRY, 0); + geo_node_type_base(&ntype, GEO_NODE_LEGACY_POINT_SCALE, "Point Scale", NODE_CLASS_GEOMETRY); ntype.declare = file_ns::node_declare; node_type_init(&ntype, file_ns::node_init); diff --git a/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_point_separate.cc b/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_point_separate.cc index 9260928b311..b9760587706 100644 --- a/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_point_separate.cc +++ b/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_point_separate.cc @@ -171,7 +171,7 @@ void register_node_type_geo_point_separate() static bNodeType ntype; geo_node_type_base( - &ntype, GEO_NODE_LEGACY_POINT_SEPARATE, "Point Separate", NODE_CLASS_GEOMETRY, 0); + &ntype, GEO_NODE_LEGACY_POINT_SEPARATE, "Point Separate", NODE_CLASS_GEOMETRY); ntype.declare = file_ns::node_declare; ntype.geometry_node_execute = file_ns::node_geo_exec; ntype.geometry_node_execute_supports_laziness = true; diff --git a/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_point_translate.cc b/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_point_translate.cc index 555bd228ac6..385c3d9f22d 100644 --- a/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_point_translate.cc +++ b/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_point_translate.cc @@ -97,7 +97,7 @@ void register_node_type_geo_point_translate() static bNodeType ntype; geo_node_type_base( - &ntype, GEO_NODE_LEGACY_POINT_TRANSLATE, "Point Translate", NODE_CLASS_GEOMETRY, 0); + &ntype, GEO_NODE_LEGACY_POINT_TRANSLATE, "Point Translate", NODE_CLASS_GEOMETRY); node_type_init(&ntype, file_ns::node_init); node_type_update(&ntype, file_ns::node_update); node_type_storage(&ntype, diff --git a/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_points_to_volume.cc b/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_points_to_volume.cc index a0cddab702b..7b1bbed8ae4 100644 --- a/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_points_to_volume.cc +++ b/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_points_to_volume.cc @@ -265,7 +265,7 @@ void register_node_type_geo_legacy_points_to_volume() static bNodeType ntype; geo_node_type_base( - &ntype, GEO_NODE_LEGACY_POINTS_TO_VOLUME, "Points to Volume", NODE_CLASS_GEOMETRY, 0); + &ntype, GEO_NODE_LEGACY_POINTS_TO_VOLUME, "Points to Volume", NODE_CLASS_GEOMETRY); node_type_storage(&ntype, "NodeGeometryPointsToVolume", node_free_standard_storage, diff --git a/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_raycast.cc b/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_raycast.cc index 5a950114840..dd03092a594 100644 --- a/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_raycast.cc +++ b/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_raycast.cc @@ -314,7 +314,7 @@ void register_node_type_geo_legacy_raycast() static bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_LEGACY_RAYCAST, "Raycast", NODE_CLASS_GEOMETRY, 0); + geo_node_type_base(&ntype, GEO_NODE_LEGACY_RAYCAST, "Raycast", NODE_CLASS_GEOMETRY); node_type_size_preset(&ntype, NODE_SIZE_LARGE); node_type_init(&ntype, file_ns::node_init); node_type_update(&ntype, file_ns::node_update); diff --git a/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_select_by_material.cc b/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_select_by_material.cc index b61ba5ff67e..59ac697b658 100644 --- a/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_select_by_material.cc +++ b/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_select_by_material.cc @@ -87,7 +87,7 @@ void register_node_type_geo_legacy_select_by_material() static bNodeType ntype; geo_node_type_base( - &ntype, GEO_NODE_LEGACY_SELECT_BY_MATERIAL, "Select by Material", NODE_CLASS_GEOMETRY, 0); + &ntype, GEO_NODE_LEGACY_SELECT_BY_MATERIAL, "Select by Material", NODE_CLASS_GEOMETRY); ntype.declare = file_ns::node_declare; ntype.geometry_node_execute = file_ns::node_geo_exec; nodeRegisterType(&ntype); diff --git a/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_subdivision_surface.cc b/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_subdivision_surface.cc index dca5c58d164..7c5553cb5e4 100644 --- a/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_subdivision_surface.cc +++ b/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_subdivision_surface.cc @@ -132,7 +132,7 @@ void register_node_type_geo_legacy_subdivision_surface() static bNodeType ntype; geo_node_type_base( - &ntype, GEO_NODE_LEGACY_SUBDIVISION_SURFACE, "Subdivision Surface", NODE_CLASS_GEOMETRY, 0); + &ntype, GEO_NODE_LEGACY_SUBDIVISION_SURFACE, "Subdivision Surface", NODE_CLASS_GEOMETRY); ntype.declare = file_ns::node_declare; ntype.geometry_node_execute = file_ns::node_geo_exec; ntype.draw_buttons = file_ns::node_layout; diff --git a/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_volume_to_mesh.cc b/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_volume_to_mesh.cc index 77ace8d072a..42fbc49ed4b 100644 --- a/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_volume_to_mesh.cc +++ b/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_volume_to_mesh.cc @@ -163,7 +163,7 @@ void register_node_type_geo_legacy_volume_to_mesh() static bNodeType ntype; geo_node_type_base( - &ntype, GEO_NODE_LEGACY_VOLUME_TO_MESH, "Volume to Mesh", NODE_CLASS_GEOMETRY, 0); + &ntype, GEO_NODE_LEGACY_VOLUME_TO_MESH, "Volume to Mesh", NODE_CLASS_GEOMETRY); ntype.declare = file_ns::node_declare; node_type_storage( &ntype, "NodeGeometryVolumeToMesh", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/geometry/nodes/node_geo_accumulate_field.cc b/source/blender/nodes/geometry/nodes/node_geo_accumulate_field.cc index 887a801aa2e..6c2e72cf14f 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_accumulate_field.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_accumulate_field.cc @@ -417,8 +417,7 @@ void register_node_type_geo_accumulate_field() static bNodeType ntype; - geo_node_type_base( - &ntype, GEO_NODE_ACCUMULATE_FIELD, "Accumulate Field", NODE_CLASS_CONVERTER, 0); + geo_node_type_base(&ntype, GEO_NODE_ACCUMULATE_FIELD, "Accumulate Field", NODE_CLASS_CONVERTER); ntype.geometry_node_execute = file_ns::node_geo_exec; node_type_init(&ntype, file_ns::node_init); node_type_update(&ntype, file_ns::node_update); diff --git a/source/blender/nodes/geometry/nodes/node_geo_attribute_capture.cc b/source/blender/nodes/geometry/nodes/node_geo_attribute_capture.cc index 6c4dd96ea9c..9001cb2d1f2 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_attribute_capture.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_attribute_capture.cc @@ -234,7 +234,7 @@ void register_node_type_geo_attribute_capture() static bNodeType ntype; geo_node_type_base( - &ntype, GEO_NODE_CAPTURE_ATTRIBUTE, "Capture Attribute", NODE_CLASS_ATTRIBUTE, 0); + &ntype, GEO_NODE_CAPTURE_ATTRIBUTE, "Capture Attribute", NODE_CLASS_ATTRIBUTE); node_type_storage(&ntype, "NodeGeometryAttributeCapture", node_free_standard_storage, diff --git a/source/blender/nodes/geometry/nodes/node_geo_attribute_domain_size.cc b/source/blender/nodes/geometry/nodes/node_geo_attribute_domain_size.cc index d6662e4e637..609ef39eb3f 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_attribute_domain_size.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_attribute_domain_size.cc @@ -143,8 +143,7 @@ void register_node_type_geo_attribute_domain_size() namespace file_ns = blender::nodes::node_geo_attribute_domain_size_cc; static bNodeType ntype; - geo_node_type_base( - &ntype, GEO_NODE_ATTRIBUTE_DOMAIN_SIZE, "Domain Size", NODE_CLASS_ATTRIBUTE, 0); + geo_node_type_base(&ntype, GEO_NODE_ATTRIBUTE_DOMAIN_SIZE, "Domain Size", NODE_CLASS_ATTRIBUTE); ntype.geometry_node_execute = file_ns::node_geo_exec; ntype.declare = file_ns::node_declare; ntype.draw_buttons = file_ns::node_layout; diff --git a/source/blender/nodes/geometry/nodes/node_geo_attribute_remove.cc b/source/blender/nodes/geometry/nodes/node_geo_attribute_remove.cc index 6f26b2c756b..8ed50b2cc75 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_attribute_remove.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_attribute_remove.cc @@ -74,8 +74,7 @@ void register_node_type_geo_attribute_remove() static bNodeType ntype; - geo_node_type_base( - &ntype, GEO_NODE_ATTRIBUTE_REMOVE, "Attribute Remove", NODE_CLASS_ATTRIBUTE, 0); + geo_node_type_base(&ntype, GEO_NODE_ATTRIBUTE_REMOVE, "Attribute Remove", NODE_CLASS_ATTRIBUTE); ntype.geometry_node_execute = file_ns::node_geo_exec; ntype.declare = file_ns::node_declare; nodeRegisterType(&ntype); diff --git a/source/blender/nodes/geometry/nodes/node_geo_attribute_statistic.cc b/source/blender/nodes/geometry/nodes/node_geo_attribute_statistic.cc index e97badeb83a..7df032b150b 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_attribute_statistic.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_attribute_statistic.cc @@ -399,7 +399,7 @@ void register_node_type_geo_attribute_statistic() static bNodeType ntype; geo_node_type_base( - &ntype, GEO_NODE_ATTRIBUTE_STATISTIC, "Attribute Statistic", NODE_CLASS_ATTRIBUTE, 0); + &ntype, GEO_NODE_ATTRIBUTE_STATISTIC, "Attribute Statistic", NODE_CLASS_ATTRIBUTE); ntype.declare = file_ns::node_declare; node_type_init(&ntype, file_ns::node_init); diff --git a/source/blender/nodes/geometry/nodes/node_geo_boolean.cc b/source/blender/nodes/geometry/nodes/node_geo_boolean.cc index 0947632cc09..a9158e0ef7a 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_boolean.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_boolean.cc @@ -127,7 +127,7 @@ void register_node_type_geo_boolean() static bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_MESH_BOOLEAN, "Mesh Boolean", NODE_CLASS_GEOMETRY, 0); + geo_node_type_base(&ntype, GEO_NODE_MESH_BOOLEAN, "Mesh Boolean", NODE_CLASS_GEOMETRY); ntype.declare = file_ns::node_declare; ntype.draw_buttons = file_ns::node_layout; ntype.updatefunc = file_ns::node_update; diff --git a/source/blender/nodes/geometry/nodes/node_geo_bounding_box.cc b/source/blender/nodes/geometry/nodes/node_geo_bounding_box.cc index da1f9a00c69..465bd72b57a 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_bounding_box.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_bounding_box.cc @@ -86,7 +86,7 @@ void register_node_type_geo_bounding_box() static bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_BOUNDING_BOX, "Bounding Box", NODE_CLASS_GEOMETRY, 0); + geo_node_type_base(&ntype, GEO_NODE_BOUNDING_BOX, "Bounding Box", NODE_CLASS_GEOMETRY); ntype.declare = file_ns::node_declare; ntype.geometry_node_execute = file_ns::node_geo_exec; nodeRegisterType(&ntype); diff --git a/source/blender/nodes/geometry/nodes/node_geo_collection_info.cc b/source/blender/nodes/geometry/nodes/node_geo_collection_info.cc index 42f4a6cb9aa..43816b8d8dc 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_collection_info.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_collection_info.cc @@ -162,7 +162,7 @@ void register_node_type_geo_collection_info() static bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_COLLECTION_INFO, "Collection Info", NODE_CLASS_INPUT, 0); + geo_node_type_base(&ntype, GEO_NODE_COLLECTION_INFO, "Collection Info", NODE_CLASS_INPUT); ntype.declare = file_ns::node_declare; node_type_init(&ntype, file_ns::node_node_init); node_type_storage(&ntype, diff --git a/source/blender/nodes/geometry/nodes/node_geo_common.cc b/source/blender/nodes/geometry/nodes/node_geo_common.cc index 64b7a80bdb4..1e00ea3d896 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_common.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_common.cc @@ -26,7 +26,7 @@ void register_node_type_geo_group() { static bNodeType ntype; - node_type_base_custom(&ntype, "GeometryNodeGroup", "Group", NODE_CLASS_GROUP, 0); + node_type_base_custom(&ntype, "GeometryNodeGroup", "Group", NODE_CLASS_GROUP); ntype.type = NODE_GROUP; ntype.poll = geo_node_poll_default; ntype.poll_instance = node_group_poll_instance; diff --git a/source/blender/nodes/geometry/nodes/node_geo_convex_hull.cc b/source/blender/nodes/geometry/nodes/node_geo_convex_hull.cc index 56c1e95bd70..11bb8a61df5 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_convex_hull.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_convex_hull.cc @@ -324,7 +324,7 @@ void register_node_type_geo_convex_hull() static bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_CONVEX_HULL, "Convex Hull", NODE_CLASS_GEOMETRY, 0); + geo_node_type_base(&ntype, GEO_NODE_CONVEX_HULL, "Convex Hull", NODE_CLASS_GEOMETRY); ntype.declare = file_ns::node_declare; ntype.geometry_node_execute = file_ns::node_geo_exec; nodeRegisterType(&ntype); diff --git a/source/blender/nodes/geometry/nodes/node_geo_curve_endpoint_selection.cc b/source/blender/nodes/geometry/nodes/node_geo_curve_endpoint_selection.cc index fc407414667..13a3d6534a3 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_curve_endpoint_selection.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_curve_endpoint_selection.cc @@ -139,7 +139,7 @@ void register_node_type_geo_curve_endpoint_selection() static bNodeType ntype; geo_node_type_base( - &ntype, GEO_NODE_CURVE_ENDPOINT_SELECTION, "Endpoint Selection", NODE_CLASS_INPUT, 0); + &ntype, GEO_NODE_CURVE_ENDPOINT_SELECTION, "Endpoint Selection", NODE_CLASS_INPUT); ntype.declare = file_ns::node_declare; ntype.geometry_node_execute = file_ns::node_geo_exec; diff --git a/source/blender/nodes/geometry/nodes/node_geo_curve_fill.cc b/source/blender/nodes/geometry/nodes/node_geo_curve_fill.cc index 92dbca060b2..7e09721273a 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_curve_fill.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_curve_fill.cc @@ -169,7 +169,7 @@ void register_node_type_geo_curve_fill() static bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_FILL_CURVE, "Fill Curve", NODE_CLASS_GEOMETRY, 0); + geo_node_type_base(&ntype, GEO_NODE_FILL_CURVE, "Fill Curve", NODE_CLASS_GEOMETRY); node_type_init(&ntype, file_ns::node_init); node_type_storage( diff --git a/source/blender/nodes/geometry/nodes/node_geo_curve_fillet.cc b/source/blender/nodes/geometry/nodes/node_geo_curve_fillet.cc index f69f773ce21..1a44fce86a6 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_curve_fillet.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_curve_fillet.cc @@ -646,7 +646,7 @@ void register_node_type_geo_curve_fillet() static bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_FILLET_CURVE, "Fillet Curve", NODE_CLASS_GEOMETRY, 0); + geo_node_type_base(&ntype, GEO_NODE_FILLET_CURVE, "Fillet Curve", NODE_CLASS_GEOMETRY); ntype.draw_buttons = file_ns::node_layout; node_type_storage( &ntype, "NodeGeometryCurveFillet", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/geometry/nodes/node_geo_curve_handle_type_selection.cc b/source/blender/nodes/geometry/nodes/node_geo_curve_handle_type_selection.cc index 50eb5dfc1a1..e4e87e519f7 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_curve_handle_type_selection.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_curve_handle_type_selection.cc @@ -155,7 +155,7 @@ void register_node_type_geo_curve_handle_type_selection() static bNodeType ntype; geo_node_type_base( - &ntype, GEO_NODE_CURVE_HANDLE_TYPE_SELECTION, "Handle Type Selection", NODE_CLASS_INPUT, 0); + &ntype, GEO_NODE_CURVE_HANDLE_TYPE_SELECTION, "Handle Type Selection", NODE_CLASS_INPUT); ntype.declare = file_ns::node_declare; ntype.geometry_node_execute = file_ns::node_geo_exec; node_type_init(&ntype, file_ns::node_init); diff --git a/source/blender/nodes/geometry/nodes/node_geo_curve_length.cc b/source/blender/nodes/geometry/nodes/node_geo_curve_length.cc index 73ad8a8cf65..21ae88a6852 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_curve_length.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_curve_length.cc @@ -48,7 +48,7 @@ void register_node_type_geo_curve_length() static bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_CURVE_LENGTH, "Curve Length", NODE_CLASS_GEOMETRY, 0); + geo_node_type_base(&ntype, GEO_NODE_CURVE_LENGTH, "Curve Length", NODE_CLASS_GEOMETRY); ntype.declare = file_ns::node_declare; ntype.geometry_node_execute = file_ns::node_geo_exec; nodeRegisterType(&ntype); diff --git a/source/blender/nodes/geometry/nodes/node_geo_curve_primitive_bezier_segment.cc b/source/blender/nodes/geometry/nodes/node_geo_curve_primitive_bezier_segment.cc index 70b9888a375..7d84ddf9917 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_curve_primitive_bezier_segment.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_curve_primitive_bezier_segment.cc @@ -129,7 +129,7 @@ void register_node_type_geo_curve_primitive_bezier_segment() static bNodeType ntype; geo_node_type_base( - &ntype, GEO_NODE_CURVE_PRIMITIVE_BEZIER_SEGMENT, "Bezier Segment", NODE_CLASS_GEOMETRY, 0); + &ntype, GEO_NODE_CURVE_PRIMITIVE_BEZIER_SEGMENT, "Bezier Segment", NODE_CLASS_GEOMETRY); node_type_init(&ntype, file_ns::node_init); node_type_storage(&ntype, "NodeGeometryCurvePrimitiveBezierSegment", diff --git a/source/blender/nodes/geometry/nodes/node_geo_curve_primitive_circle.cc b/source/blender/nodes/geometry/nodes/node_geo_curve_primitive_circle.cc index 6d689b907fc..a7fb493c7d7 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_curve_primitive_circle.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_curve_primitive_circle.cc @@ -231,8 +231,7 @@ void register_node_type_geo_curve_primitive_circle() namespace file_ns = blender::nodes::node_geo_curve_primitive_circle_cc; static bNodeType ntype; - geo_node_type_base( - &ntype, GEO_NODE_CURVE_PRIMITIVE_CIRCLE, "Curve Circle", NODE_CLASS_GEOMETRY, 0); + geo_node_type_base(&ntype, GEO_NODE_CURVE_PRIMITIVE_CIRCLE, "Curve Circle", NODE_CLASS_GEOMETRY); node_type_init(&ntype, file_ns::node_init); node_type_update(&ntype, file_ns::node_update); diff --git a/source/blender/nodes/geometry/nodes/node_geo_curve_primitive_line.cc b/source/blender/nodes/geometry/nodes/node_geo_curve_primitive_line.cc index 592374ddd81..ff9218b1ac2 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_curve_primitive_line.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_curve_primitive_line.cc @@ -135,7 +135,7 @@ void register_node_type_geo_curve_primitive_line() namespace file_ns = blender::nodes::node_geo_curve_primitive_line_cc; static bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_CURVE_PRIMITIVE_LINE, "Curve Line", NODE_CLASS_GEOMETRY, 0); + geo_node_type_base(&ntype, GEO_NODE_CURVE_PRIMITIVE_LINE, "Curve Line", NODE_CLASS_GEOMETRY); node_type_init(&ntype, file_ns::node_init); node_type_update(&ntype, file_ns::node_update); node_type_storage(&ntype, diff --git a/source/blender/nodes/geometry/nodes/node_geo_curve_primitive_quadratic_bezier.cc b/source/blender/nodes/geometry/nodes/node_geo_curve_primitive_quadratic_bezier.cc index 4b2bd586db2..084d27e9d24 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_curve_primitive_quadratic_bezier.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_curve_primitive_quadratic_bezier.cc @@ -85,11 +85,8 @@ void register_node_type_geo_curve_primitive_quadratic_bezier() namespace file_ns = blender::nodes::node_geo_curve_primitive_quadratic_bezier_cc; static bNodeType ntype; - geo_node_type_base(&ntype, - GEO_NODE_CURVE_PRIMITIVE_QUADRATIC_BEZIER, - "Quadratic Bezier", - NODE_CLASS_GEOMETRY, - 0); + geo_node_type_base( + &ntype, GEO_NODE_CURVE_PRIMITIVE_QUADRATIC_BEZIER, "Quadratic Bezier", NODE_CLASS_GEOMETRY); ntype.declare = file_ns::node_declare; ntype.geometry_node_execute = file_ns::node_geo_exec; nodeRegisterType(&ntype); diff --git a/source/blender/nodes/geometry/nodes/node_geo_curve_primitive_quadrilateral.cc b/source/blender/nodes/geometry/nodes/node_geo_curve_primitive_quadrilateral.cc index 98480971fbd..02e7247fe59 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_curve_primitive_quadrilateral.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_curve_primitive_quadrilateral.cc @@ -289,7 +289,7 @@ void register_node_type_geo_curve_primitive_quadrilateral() static bNodeType ntype; geo_node_type_base( - &ntype, GEO_NODE_CURVE_PRIMITIVE_QUADRILATERAL, "Quadrilateral", NODE_CLASS_GEOMETRY, 0); + &ntype, GEO_NODE_CURVE_PRIMITIVE_QUADRILATERAL, "Quadrilateral", NODE_CLASS_GEOMETRY); ntype.declare = file_ns::node_declare; ntype.geometry_node_execute = file_ns::node_geo_exec; ntype.draw_buttons = file_ns::node_layout; diff --git a/source/blender/nodes/geometry/nodes/node_geo_curve_primitive_spiral.cc b/source/blender/nodes/geometry/nodes/node_geo_curve_primitive_spiral.cc index 8661ba1f067..6aba65b5638 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_curve_primitive_spiral.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_curve_primitive_spiral.cc @@ -111,7 +111,7 @@ void register_node_type_geo_curve_primitive_spiral() static bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_CURVE_PRIMITIVE_SPIRAL, "Spiral", NODE_CLASS_GEOMETRY, 0); + geo_node_type_base(&ntype, GEO_NODE_CURVE_PRIMITIVE_SPIRAL, "Spiral", NODE_CLASS_GEOMETRY); ntype.declare = file_ns::node_declare; ntype.geometry_node_execute = file_ns::node_geo_exec; nodeRegisterType(&ntype); diff --git a/source/blender/nodes/geometry/nodes/node_geo_curve_primitive_star.cc b/source/blender/nodes/geometry/nodes/node_geo_curve_primitive_star.cc index 8841f558435..14517a79037 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_curve_primitive_star.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_curve_primitive_star.cc @@ -115,7 +115,7 @@ void register_node_type_geo_curve_primitive_star() namespace file_ns = blender::nodes::node_geo_curve_primitive_star_cc; static bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_CURVE_PRIMITIVE_STAR, "Star", NODE_CLASS_GEOMETRY, 0); + geo_node_type_base(&ntype, GEO_NODE_CURVE_PRIMITIVE_STAR, "Star", NODE_CLASS_GEOMETRY); ntype.declare = file_ns::node_declare; ntype.geometry_node_execute = file_ns::node_geo_exec; nodeRegisterType(&ntype); diff --git a/source/blender/nodes/geometry/nodes/node_geo_curve_resample.cc b/source/blender/nodes/geometry/nodes/node_geo_curve_resample.cc index c11b4cb5cc8..8494b4868e8 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_curve_resample.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_curve_resample.cc @@ -297,7 +297,7 @@ void register_node_type_geo_curve_resample() static bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_RESAMPLE_CURVE, "Resample Curve", NODE_CLASS_GEOMETRY, 0); + geo_node_type_base(&ntype, GEO_NODE_RESAMPLE_CURVE, "Resample Curve", NODE_CLASS_GEOMETRY); ntype.declare = file_ns::node_declare; ntype.draw_buttons = file_ns::node_layout; node_type_storage( diff --git a/source/blender/nodes/geometry/nodes/node_geo_curve_reverse.cc b/source/blender/nodes/geometry/nodes/node_geo_curve_reverse.cc index d07e89ec7f2..38974fafce7 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_curve_reverse.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_curve_reverse.cc @@ -67,7 +67,7 @@ void register_node_type_geo_curve_reverse() namespace file_ns = blender::nodes::node_geo_curve_reverse_cc; static bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_REVERSE_CURVE, "Reverse Curve", NODE_CLASS_GEOMETRY, 0); + geo_node_type_base(&ntype, GEO_NODE_REVERSE_CURVE, "Reverse Curve", NODE_CLASS_GEOMETRY); ntype.declare = file_ns::node_declare; ntype.geometry_node_execute = file_ns::node_geo_exec; nodeRegisterType(&ntype); diff --git a/source/blender/nodes/geometry/nodes/node_geo_curve_sample.cc b/source/blender/nodes/geometry/nodes/node_geo_curve_sample.cc index 35737f74499..038f7625825 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_curve_sample.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_curve_sample.cc @@ -286,7 +286,7 @@ void register_node_type_geo_curve_sample() static bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_SAMPLE_CURVE, "Sample Curve", NODE_CLASS_GEOMETRY, 0); + geo_node_type_base(&ntype, GEO_NODE_SAMPLE_CURVE, "Sample Curve", NODE_CLASS_GEOMETRY); ntype.geometry_node_execute = file_ns::node_geo_exec; ntype.declare = file_ns::node_declare; node_type_init(&ntype, file_ns::node_type_init); diff --git a/source/blender/nodes/geometry/nodes/node_geo_curve_set_handles.cc b/source/blender/nodes/geometry/nodes/node_geo_curve_set_handles.cc index 0124e9bd9dd..b4ca51d0fa7 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_curve_set_handles.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_curve_set_handles.cc @@ -135,8 +135,7 @@ void register_node_type_geo_curve_set_handles() namespace file_ns = blender::nodes::node_geo_curve_set_handles_cc; static bNodeType ntype; - geo_node_type_base( - &ntype, GEO_NODE_CURVE_SET_HANDLES, "Set Handle Type", NODE_CLASS_GEOMETRY, 0); + geo_node_type_base(&ntype, GEO_NODE_CURVE_SET_HANDLES, "Set Handle Type", NODE_CLASS_GEOMETRY); ntype.declare = file_ns::node_declare; ntype.geometry_node_execute = file_ns::node_geo_exec; node_type_init(&ntype, file_ns::node_init); diff --git a/source/blender/nodes/geometry/nodes/node_geo_curve_spline_parameter.cc b/source/blender/nodes/geometry/nodes/node_geo_curve_spline_parameter.cc index de352d217ed..40dde645756 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_curve_spline_parameter.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_curve_spline_parameter.cc @@ -319,7 +319,7 @@ void register_node_type_geo_curve_spline_parameter() static bNodeType ntype; geo_node_type_base( - &ntype, GEO_NODE_CURVE_SPLINE_PARAMETER, "Spline Parameter", NODE_CLASS_INPUT, 0); + &ntype, GEO_NODE_CURVE_SPLINE_PARAMETER, "Spline Parameter", NODE_CLASS_INPUT); ntype.geometry_node_execute = file_ns::node_geo_exec; ntype.declare = file_ns::node_declare; nodeRegisterType(&ntype); diff --git a/source/blender/nodes/geometry/nodes/node_geo_curve_spline_type.cc b/source/blender/nodes/geometry/nodes/node_geo_curve_spline_type.cc index 2d07ac5411f..5745eb86949 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_curve_spline_type.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_curve_spline_type.cc @@ -297,8 +297,7 @@ void register_node_type_geo_curve_spline_type() namespace file_ns = blender::nodes::node_geo_curve_spline_type_cc; static bNodeType ntype; - geo_node_type_base( - &ntype, GEO_NODE_CURVE_SPLINE_TYPE, "Set Spline Type", NODE_CLASS_GEOMETRY, 0); + geo_node_type_base(&ntype, GEO_NODE_CURVE_SPLINE_TYPE, "Set Spline Type", NODE_CLASS_GEOMETRY); ntype.declare = file_ns::node_declare; ntype.geometry_node_execute = file_ns::node_geo_exec; node_type_init(&ntype, file_ns::node_init); diff --git a/source/blender/nodes/geometry/nodes/node_geo_curve_subdivide.cc b/source/blender/nodes/geometry/nodes/node_geo_curve_subdivide.cc index 6de188fc1c4..ae282017e0c 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_curve_subdivide.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_curve_subdivide.cc @@ -359,7 +359,7 @@ void register_node_type_geo_curve_subdivide() static bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_SUBDIVIDE_CURVE, "Subdivide Curve", NODE_CLASS_GEOMETRY, 0); + geo_node_type_base(&ntype, GEO_NODE_SUBDIVIDE_CURVE, "Subdivide Curve", NODE_CLASS_GEOMETRY); ntype.declare = file_ns::node_declare; ntype.geometry_node_execute = file_ns::node_geo_exec; nodeRegisterType(&ntype); diff --git a/source/blender/nodes/geometry/nodes/node_geo_curve_to_mesh.cc b/source/blender/nodes/geometry/nodes/node_geo_curve_to_mesh.cc index ff3e85cb6b7..ef4fc51d1b3 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_curve_to_mesh.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_curve_to_mesh.cc @@ -80,7 +80,7 @@ void register_node_type_geo_curve_to_mesh() static bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_CURVE_TO_MESH, "Curve to Mesh", NODE_CLASS_GEOMETRY, 0); + geo_node_type_base(&ntype, GEO_NODE_CURVE_TO_MESH, "Curve to Mesh", NODE_CLASS_GEOMETRY); ntype.declare = file_ns::node_declare; ntype.geometry_node_execute = file_ns::node_geo_exec; nodeRegisterType(&ntype); diff --git a/source/blender/nodes/geometry/nodes/node_geo_curve_to_points.cc b/source/blender/nodes/geometry/nodes/node_geo_curve_to_points.cc index d20fd66017e..a8553b636a4 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_curve_to_points.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_curve_to_points.cc @@ -402,7 +402,7 @@ void register_node_type_geo_curve_to_points() static bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_CURVE_TO_POINTS, "Curve to Points", NODE_CLASS_GEOMETRY, 0); + geo_node_type_base(&ntype, GEO_NODE_CURVE_TO_POINTS, "Curve to Points", NODE_CLASS_GEOMETRY); ntype.declare = file_ns::node_declare; ntype.geometry_node_execute = file_ns::node_geo_exec; ntype.draw_buttons = file_ns::node_layout; diff --git a/source/blender/nodes/geometry/nodes/node_geo_curve_trim.cc b/source/blender/nodes/geometry/nodes/node_geo_curve_trim.cc index 2f96696cee4..359863d39e0 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_curve_trim.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_curve_trim.cc @@ -607,7 +607,7 @@ void register_node_type_geo_curve_trim() namespace file_ns = blender::nodes::node_geo_curve_trim_cc; static bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_TRIM_CURVE, "Trim Curve", NODE_CLASS_GEOMETRY, 0); + geo_node_type_base(&ntype, GEO_NODE_TRIM_CURVE, "Trim Curve", NODE_CLASS_GEOMETRY); ntype.geometry_node_execute = file_ns::node_geo_exec; ntype.draw_buttons = file_ns::node_layout; ntype.declare = file_ns::node_declare; diff --git a/source/blender/nodes/geometry/nodes/node_geo_delete_geometry.cc b/source/blender/nodes/geometry/nodes/node_geo_delete_geometry.cc index 7d41242b8bc..5ea8034c437 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_delete_geometry.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_delete_geometry.cc @@ -545,7 +545,7 @@ static void separate_instance_selection(GeometrySet &geometry_set, Vector<int64_t> indices; const IndexMask mask = index_mask_indices(selection, invert, indices); - if (mask.size() == 0) { + if (mask.is_empty()) { geometry_set.remove<InstancesComponent>(); return; } @@ -1377,7 +1377,7 @@ void register_node_type_geo_delete_geometry() static bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_DELETE_GEOMETRY, "Delete Geometry", NODE_CLASS_GEOMETRY, 0); + geo_node_type_base(&ntype, GEO_NODE_DELETE_GEOMETRY, "Delete Geometry", NODE_CLASS_GEOMETRY); node_type_storage(&ntype, "NodeGeometryDeleteGeometry", diff --git a/source/blender/nodes/geometry/nodes/node_geo_distribute_points_on_faces.cc b/source/blender/nodes/geometry/nodes/node_geo_distribute_points_on_faces.cc index 3537b62c76e..a257af4391c 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_distribute_points_on_faces.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_distribute_points_on_faces.cc @@ -573,8 +573,7 @@ void register_node_type_geo_distribute_points_on_faces() geo_node_type_base(&ntype, GEO_NODE_DISTRIBUTE_POINTS_ON_FACES, "Distribute Points on Faces", - NODE_CLASS_GEOMETRY, - 0); + NODE_CLASS_GEOMETRY); node_type_update(&ntype, file_ns::node_point_distribute_points_on_faces_update); node_type_size(&ntype, 170, 100, 320); ntype.declare = file_ns::node_declare; diff --git a/source/blender/nodes/geometry/nodes/node_geo_dual_mesh.cc b/source/blender/nodes/geometry/nodes/node_geo_dual_mesh.cc index d1cbaa540d7..ed4def0cf68 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_dual_mesh.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_dual_mesh.cc @@ -924,7 +924,7 @@ void register_node_type_geo_dual_mesh() namespace file_ns = blender::nodes::node_geo_dual_mesh_cc; static bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_DUAL_MESH, "Dual Mesh", NODE_CLASS_GEOMETRY, 0); + geo_node_type_base(&ntype, GEO_NODE_DUAL_MESH, "Dual Mesh", NODE_CLASS_GEOMETRY); ntype.declare = file_ns::node_declare; ntype.geometry_node_execute = file_ns::node_geo_exec; nodeRegisterType(&ntype); diff --git a/source/blender/nodes/geometry/nodes/node_geo_edge_split.cc b/source/blender/nodes/geometry/nodes/node_geo_edge_split.cc index d23a18ba37b..9376789cf2c 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_edge_split.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_edge_split.cc @@ -90,7 +90,7 @@ void register_node_type_geo_edge_split() static bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_SPLIT_EDGES, "Split Edges", NODE_CLASS_GEOMETRY, 0); + geo_node_type_base(&ntype, GEO_NODE_SPLIT_EDGES, "Split Edges", NODE_CLASS_GEOMETRY); ntype.geometry_node_execute = file_ns::node_geo_exec; ntype.declare = file_ns::node_declare; nodeRegisterType(&ntype); diff --git a/source/blender/nodes/geometry/nodes/node_geo_geometry_to_instance.cc b/source/blender/nodes/geometry/nodes/node_geo_geometry_to_instance.cc index 7faf104737f..f65af5b6737 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_geometry_to_instance.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_geometry_to_instance.cc @@ -47,7 +47,7 @@ void register_node_type_geo_geometry_to_instance() static bNodeType ntype; geo_node_type_base( - &ntype, GEO_NODE_GEOMETRY_TO_INSTANCE, "Geometry to Instance", NODE_CLASS_GEOMETRY, 0); + &ntype, GEO_NODE_GEOMETRY_TO_INSTANCE, "Geometry to Instance", NODE_CLASS_GEOMETRY); node_type_size(&ntype, 160, 100, 300); ntype.geometry_node_execute = file_ns::node_geo_exec; ntype.declare = file_ns::node_declare; diff --git a/source/blender/nodes/geometry/nodes/node_geo_image_texture.cc b/source/blender/nodes/geometry/nodes/node_geo_image_texture.cc index 52ef48f147b..28a8fb80294 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_image_texture.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_image_texture.cc @@ -415,7 +415,7 @@ void register_node_type_geo_image_texture() static bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_IMAGE_TEXTURE, "Image Texture", NODE_CLASS_TEXTURE, 0); + geo_node_type_base(&ntype, GEO_NODE_IMAGE_TEXTURE, "Image Texture", NODE_CLASS_TEXTURE); ntype.declare = file_ns::node_declare; ntype.draw_buttons = file_ns::node_layout; node_type_init(&ntype, file_ns::node_init); diff --git a/source/blender/nodes/geometry/nodes/node_geo_input_curve_handles.cc b/source/blender/nodes/geometry/nodes/node_geo_input_curve_handles.cc index dae8fda2099..c3c26736e88 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_input_curve_handles.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_input_curve_handles.cc @@ -40,7 +40,7 @@ void register_node_type_geo_input_curve_handles() static bNodeType ntype; geo_node_type_base( - &ntype, GEO_NODE_INPUT_CURVE_HANDLES, "Curve Handle Positions", NODE_CLASS_INPUT, 0); + &ntype, GEO_NODE_INPUT_CURVE_HANDLES, "Curve Handle Positions", NODE_CLASS_INPUT); node_type_size_preset(&ntype, NODE_SIZE_MIDDLE); ntype.geometry_node_execute = file_ns::node_geo_exec; ntype.declare = file_ns::node_declare; diff --git a/source/blender/nodes/geometry/nodes/node_geo_input_curve_tilt.cc b/source/blender/nodes/geometry/nodes/node_geo_input_curve_tilt.cc index 5ba85b6f34e..61b4b6bb9e9 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_input_curve_tilt.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_input_curve_tilt.cc @@ -37,7 +37,7 @@ void register_node_type_geo_input_curve_tilt() static bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_INPUT_CURVE_TILT, "Curve Tilt", NODE_CLASS_INPUT, 0); + geo_node_type_base(&ntype, GEO_NODE_INPUT_CURVE_TILT, "Curve Tilt", NODE_CLASS_INPUT); ntype.geometry_node_execute = file_ns::node_geo_exec; ntype.declare = file_ns::node_declare; nodeRegisterType(&ntype); diff --git a/source/blender/nodes/geometry/nodes/node_geo_input_id.cc b/source/blender/nodes/geometry/nodes/node_geo_input_id.cc index d2e103a093a..3fe0588a46d 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_input_id.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_input_id.cc @@ -37,7 +37,7 @@ void register_node_type_geo_input_id() static bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_INPUT_ID, "ID", NODE_CLASS_INPUT, 0); + geo_node_type_base(&ntype, GEO_NODE_INPUT_ID, "ID", NODE_CLASS_INPUT); ntype.geometry_node_execute = file_ns::node_geo_exec; ntype.declare = file_ns::node_declare; nodeRegisterType(&ntype); diff --git a/source/blender/nodes/geometry/nodes/node_geo_input_index.cc b/source/blender/nodes/geometry/nodes/node_geo_input_index.cc index 74cddfc6a4a..98c2c9d58f0 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_input_index.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_input_index.cc @@ -37,7 +37,7 @@ void register_node_type_geo_input_index() static bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_INPUT_INDEX, "Index", NODE_CLASS_INPUT, 0); + geo_node_type_base(&ntype, GEO_NODE_INPUT_INDEX, "Index", NODE_CLASS_INPUT); ntype.geometry_node_execute = file_ns::node_geo_exec; ntype.declare = file_ns::node_declare; nodeRegisterType(&ntype); diff --git a/source/blender/nodes/geometry/nodes/node_geo_input_material.cc b/source/blender/nodes/geometry/nodes/node_geo_input_material.cc index 1b6e3c8fc68..a1c905fccaa 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_input_material.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_input_material.cc @@ -45,7 +45,7 @@ void register_node_type_geo_input_material() static bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_INPUT_MATERIAL, "Material", NODE_CLASS_INPUT, 0); + geo_node_type_base(&ntype, GEO_NODE_INPUT_MATERIAL, "Material", NODE_CLASS_INPUT); ntype.draw_buttons = file_ns::node_layout; ntype.declare = file_ns::node_declare; ntype.geometry_node_execute = file_ns::node_geo_exec; diff --git a/source/blender/nodes/geometry/nodes/node_geo_input_material_index.cc b/source/blender/nodes/geometry/nodes/node_geo_input_material_index.cc index 4df218eb669..fca29feb73c 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_input_material_index.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_input_material_index.cc @@ -37,7 +37,7 @@ void register_node_type_geo_input_material_index() static bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_INPUT_MATERIAL_INDEX, "Material Index", NODE_CLASS_INPUT, 0); + geo_node_type_base(&ntype, GEO_NODE_INPUT_MATERIAL_INDEX, "Material Index", NODE_CLASS_INPUT); ntype.geometry_node_execute = file_ns::node_geo_exec; ntype.declare = file_ns::node_declare; nodeRegisterType(&ntype); diff --git a/source/blender/nodes/geometry/nodes/node_geo_input_mesh_edge_angle.cc b/source/blender/nodes/geometry/nodes/node_geo_input_mesh_edge_angle.cc new file mode 100644 index 00000000000..2d16c60ba86 --- /dev/null +++ b/source/blender/nodes/geometry/nodes/node_geo_input_mesh_edge_angle.cc @@ -0,0 +1,128 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#include "DNA_mesh_types.h" +#include "DNA_meshdata_types.h" + +#include "BKE_mesh.h" + +#include "node_geometry_util.hh" + +namespace blender::nodes::node_geo_input_mesh_edge_angle_cc { + +static void node_declare(NodeDeclarationBuilder &b) +{ + b.add_output<decl::Float>(N_("Angle")) + .field_source() + .description( + "The angle in radians between two faces where they meet at an edge. Flat edges and " + "Non-manifold edges have an angle of zero"); +} + +struct EdgeMapEntry { + int face_count; + int face_index_1; + int face_index_2; +}; + +class AngleFieldInput final : public GeometryFieldInput { + public: + AngleFieldInput() : GeometryFieldInput(CPPType::get<float>(), "Angle Field") + { + category_ = Category::Generated; + } + + GVArray get_varray_for_context(const GeometryComponent &component, + const AttributeDomain domain, + IndexMask UNUSED(mask)) const final + { + if (component.type() != GEO_COMPONENT_TYPE_MESH) { + return {}; + } + + const MeshComponent &mesh_component = static_cast<const MeshComponent &>(component); + const Mesh *mesh = mesh_component.get_for_read(); + if (mesh == nullptr) { + return {}; + } + + Span<MPoly> polys{mesh->mpoly, mesh->totpoly}; + Span<MLoop> loops{mesh->mloop, mesh->totloop}; + Array<EdgeMapEntry> edge_map(mesh->totedge, {0, 0, 0}); + + for (const int i_poly : polys.index_range()) { + const MPoly &mpoly = polys[i_poly]; + for (const MLoop &loop : loops.slice(mpoly.loopstart, mpoly.totloop)) { + EdgeMapEntry &entry = edge_map[loop.e]; + if (entry.face_count == 0) { + entry.face_index_1 = i_poly; + } + else if (entry.face_count == 1) { + entry.face_index_2 = i_poly; + } + entry.face_count++; + } + } + + auto angle_fn = [edge_map, polys, loops, mesh](const int i) -> float { + if (edge_map[i].face_count == 2) { + const MPoly &mpoly_1 = polys[edge_map[i].face_index_1]; + const MPoly &mpoly_2 = polys[edge_map[i].face_index_2]; + float3 normal_1, normal_2; + BKE_mesh_calc_poly_normal(&mpoly_1, &loops[mpoly_1.loopstart], mesh->mvert, normal_1); + BKE_mesh_calc_poly_normal(&mpoly_2, &loops[mpoly_2.loopstart], mesh->mvert, normal_2); + return angle_normalized_v3v3(normal_1, normal_2); + } + else { + return 0.0f; + } + }; + + VArray<float> angles = VArray<float>::ForFunc(mesh->totedge, angle_fn); + return component.attribute_try_adapt_domain<float>( + std::move(angles), ATTR_DOMAIN_EDGE, domain); + } + + uint64_t hash() const override + { + /* Some random constant hash. */ + return 32426725235; + } + + bool is_equal_to(const fn::FieldNode &other) const override + { + return dynamic_cast<const AngleFieldInput *>(&other) != nullptr; + } +}; + +static void node_geo_exec(GeoNodeExecParams params) +{ + Field<float> angle_field{std::make_shared<AngleFieldInput>()}; + params.set_output("Angle", std::move(angle_field)); +} + +} // namespace blender::nodes::node_geo_input_mesh_edge_angle_cc + +void register_node_type_geo_input_mesh_edge_angle() +{ + namespace file_ns = blender::nodes::node_geo_input_mesh_edge_angle_cc; + + static bNodeType ntype; + geo_node_type_base(&ntype, GEO_NODE_INPUT_MESH_EDGE_ANGLE, "Edge Angle", NODE_CLASS_INPUT); + ntype.declare = file_ns::node_declare; + ntype.geometry_node_execute = file_ns::node_geo_exec; + nodeRegisterType(&ntype); +} diff --git a/source/blender/nodes/geometry/nodes/node_geo_input_mesh_edge_neighbors.cc b/source/blender/nodes/geometry/nodes/node_geo_input_mesh_edge_neighbors.cc index ede87252312..ddeb3ded511 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_input_mesh_edge_neighbors.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_input_mesh_edge_neighbors.cc @@ -86,7 +86,7 @@ void register_node_type_geo_input_mesh_edge_neighbors() static bNodeType ntype; geo_node_type_base( - &ntype, GEO_NODE_INPUT_MESH_EDGE_NEIGHBORS, "Edge Neighbors", NODE_CLASS_INPUT, 0); + &ntype, GEO_NODE_INPUT_MESH_EDGE_NEIGHBORS, "Edge Neighbors", NODE_CLASS_INPUT); ntype.declare = file_ns::node_declare; ntype.geometry_node_execute = file_ns::node_geo_exec; nodeRegisterType(&ntype); diff --git a/source/blender/nodes/geometry/nodes/node_geo_input_mesh_edge_vertices.cc b/source/blender/nodes/geometry/nodes/node_geo_input_mesh_edge_vertices.cc index edf3f7c3e81..f54c92fea7b 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_input_mesh_edge_vertices.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_input_mesh_edge_vertices.cc @@ -179,8 +179,7 @@ void register_node_type_geo_input_mesh_edge_vertices() namespace file_ns = blender::nodes::node_geo_input_mesh_edge_vertices_cc; static bNodeType ntype; - geo_node_type_base( - &ntype, GEO_NODE_INPUT_MESH_EDGE_VERTICES, "Edge Vertices", NODE_CLASS_INPUT, 0); + geo_node_type_base(&ntype, GEO_NODE_INPUT_MESH_EDGE_VERTICES, "Edge Vertices", NODE_CLASS_INPUT); ntype.declare = file_ns::node_declare; ntype.geometry_node_execute = file_ns::node_geo_exec; nodeRegisterType(&ntype); diff --git a/source/blender/nodes/geometry/nodes/node_geo_input_mesh_face_area.cc b/source/blender/nodes/geometry/nodes/node_geo_input_mesh_face_area.cc index 538b9e9682d..ef8adff48f1 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_input_mesh_face_area.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_input_mesh_face_area.cc @@ -89,7 +89,7 @@ void register_node_type_geo_input_mesh_face_area() namespace file_ns = blender::nodes::node_geo_input_mesh_face_area_cc; static bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_INPUT_MESH_FACE_AREA, "Face Area", NODE_CLASS_INPUT, 0); + geo_node_type_base(&ntype, GEO_NODE_INPUT_MESH_FACE_AREA, "Face Area", NODE_CLASS_INPUT); ntype.declare = file_ns::node_declare; ntype.geometry_node_execute = file_ns::node_geo_exec; nodeRegisterType(&ntype); diff --git a/source/blender/nodes/geometry/nodes/node_geo_input_mesh_face_neighbors.cc b/source/blender/nodes/geometry/nodes/node_geo_input_mesh_face_neighbors.cc index 80bb25dc7ca..8d196e5f8dd 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_input_mesh_face_neighbors.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_input_mesh_face_neighbors.cc @@ -150,7 +150,7 @@ void register_node_type_geo_input_mesh_face_neighbors() static bNodeType ntype; geo_node_type_base( - &ntype, GEO_NODE_INPUT_MESH_FACE_NEIGHBORS, "Face Neighbors", NODE_CLASS_INPUT, 0); + &ntype, GEO_NODE_INPUT_MESH_FACE_NEIGHBORS, "Face Neighbors", NODE_CLASS_INPUT); node_type_size_preset(&ntype, NODE_SIZE_MIDDLE); ntype.declare = file_ns::node_declare; ntype.geometry_node_execute = file_ns::node_geo_exec; diff --git a/source/blender/nodes/geometry/nodes/node_geo_input_mesh_island.cc b/source/blender/nodes/geometry/nodes/node_geo_input_mesh_island.cc index 3c713ef6ca9..629279a44e9 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_input_mesh_island.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_input_mesh_island.cc @@ -94,7 +94,7 @@ void register_node_type_geo_input_mesh_island() namespace file_ns = blender::nodes::node_geo_input_mesh_island_cc; static bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_INPUT_MESH_ISLAND, "Mesh Island", NODE_CLASS_INPUT, 0); + geo_node_type_base(&ntype, GEO_NODE_INPUT_MESH_ISLAND, "Mesh Island", NODE_CLASS_INPUT); ntype.declare = file_ns::node_declare; ntype.geometry_node_execute = file_ns::node_geo_exec; nodeRegisterType(&ntype); diff --git a/source/blender/nodes/geometry/nodes/node_geo_input_mesh_vertex_neighbors.cc b/source/blender/nodes/geometry/nodes/node_geo_input_mesh_vertex_neighbors.cc index 05140c92205..7d79164634d 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_input_mesh_vertex_neighbors.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_input_mesh_vertex_neighbors.cc @@ -148,7 +148,7 @@ void register_node_type_geo_input_mesh_vertex_neighbors() static bNodeType ntype; geo_node_type_base( - &ntype, GEO_NODE_INPUT_MESH_VERTEX_NEIGHBORS, "Vertex Neighbors", NODE_CLASS_INPUT, 0); + &ntype, GEO_NODE_INPUT_MESH_VERTEX_NEIGHBORS, "Vertex Neighbors", NODE_CLASS_INPUT); ntype.declare = file_ns::node_declare; ntype.geometry_node_execute = file_ns::node_geo_exec; nodeRegisterType(&ntype); diff --git a/source/blender/nodes/geometry/nodes/node_geo_input_normal.cc b/source/blender/nodes/geometry/nodes/node_geo_input_normal.cc index 1cc508d9d9d..86c2b0e4543 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_input_normal.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_input_normal.cc @@ -282,7 +282,7 @@ void register_node_type_geo_input_normal() static bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_INPUT_NORMAL, "Normal", NODE_CLASS_INPUT, 0); + geo_node_type_base(&ntype, GEO_NODE_INPUT_NORMAL, "Normal", NODE_CLASS_INPUT); ntype.geometry_node_execute = file_ns::node_geo_exec; ntype.declare = file_ns::node_declare; nodeRegisterType(&ntype); diff --git a/source/blender/nodes/geometry/nodes/node_geo_input_position.cc b/source/blender/nodes/geometry/nodes/node_geo_input_position.cc index 8322831a871..beb528d2fd8 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_input_position.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_input_position.cc @@ -37,7 +37,7 @@ void register_node_type_geo_input_position() static bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_INPUT_POSITION, "Position", NODE_CLASS_INPUT, 0); + geo_node_type_base(&ntype, GEO_NODE_INPUT_POSITION, "Position", NODE_CLASS_INPUT); ntype.geometry_node_execute = file_ns::node_geo_exec; ntype.declare = file_ns::node_declare; nodeRegisterType(&ntype); diff --git a/source/blender/nodes/geometry/nodes/node_geo_input_radius.cc b/source/blender/nodes/geometry/nodes/node_geo_input_radius.cc index 26fb74f5a5b..c7777da08c6 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_input_radius.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_input_radius.cc @@ -37,7 +37,7 @@ void register_node_type_geo_input_radius() static bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_INPUT_RADIUS, "Radius", NODE_CLASS_INPUT, 0); + geo_node_type_base(&ntype, GEO_NODE_INPUT_RADIUS, "Radius", NODE_CLASS_INPUT); ntype.geometry_node_execute = file_ns::node_geo_exec; ntype.declare = file_ns::node_declare; nodeRegisterType(&ntype); diff --git a/source/blender/nodes/geometry/nodes/node_geo_input_scene_time.cc b/source/blender/nodes/geometry/nodes/node_geo_input_scene_time.cc index cfc1a81f7b9..4ed65e99a1c 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_input_scene_time.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_input_scene_time.cc @@ -43,7 +43,7 @@ void register_node_type_geo_input_scene_time() { static bNodeType ntype; namespace file_ns = blender::nodes::node_geo_input_scene_time_cc; - geo_node_type_base(&ntype, GEO_NODE_INPUT_SCENE_TIME, "Scene Time", NODE_CLASS_INPUT, 0); + geo_node_type_base(&ntype, GEO_NODE_INPUT_SCENE_TIME, "Scene Time", NODE_CLASS_INPUT); ntype.geometry_node_execute = file_ns::node_exec; ntype.declare = file_ns::node_declare; nodeRegisterType(&ntype); diff --git a/source/blender/nodes/geometry/nodes/node_geo_input_shade_smooth.cc b/source/blender/nodes/geometry/nodes/node_geo_input_shade_smooth.cc index 3efe8577e51..b27ab097223 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_input_shade_smooth.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_input_shade_smooth.cc @@ -37,7 +37,7 @@ void register_node_type_geo_input_shade_smooth() static bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_INPUT_SHADE_SMOOTH, "Is Shade Smooth", NODE_CLASS_INPUT, 0); + geo_node_type_base(&ntype, GEO_NODE_INPUT_SHADE_SMOOTH, "Is Shade Smooth", NODE_CLASS_INPUT); ntype.geometry_node_execute = file_ns::node_geo_exec; ntype.declare = file_ns::node_declare; nodeRegisterType(&ntype); diff --git a/source/blender/nodes/geometry/nodes/node_geo_input_spline_cyclic.cc b/source/blender/nodes/geometry/nodes/node_geo_input_spline_cyclic.cc index 5f833445a76..2db00a1ae68 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_input_spline_cyclic.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_input_spline_cyclic.cc @@ -37,8 +37,7 @@ void register_node_type_geo_input_spline_cyclic() static bNodeType ntype; - geo_node_type_base( - &ntype, GEO_NODE_INPUT_SPLINE_CYCLIC, "Is Spline Cyclic", NODE_CLASS_INPUT, 0); + geo_node_type_base(&ntype, GEO_NODE_INPUT_SPLINE_CYCLIC, "Is Spline Cyclic", NODE_CLASS_INPUT); ntype.geometry_node_execute = file_ns::node_geo_exec; ntype.declare = file_ns::node_declare; nodeRegisterType(&ntype); diff --git a/source/blender/nodes/geometry/nodes/node_geo_input_spline_length.cc b/source/blender/nodes/geometry/nodes/node_geo_input_spline_length.cc index 810d6e2fddd..b8c8ce840eb 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_input_spline_length.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_input_spline_length.cc @@ -156,7 +156,7 @@ void register_node_type_geo_input_spline_length() namespace file_ns = blender::nodes::node_geo_input_spline_length_cc; static bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_INPUT_SPLINE_LENGTH, "Spline Length", NODE_CLASS_INPUT, 0); + geo_node_type_base(&ntype, GEO_NODE_INPUT_SPLINE_LENGTH, "Spline Length", NODE_CLASS_INPUT); ntype.geometry_node_execute = file_ns::node_geo_exec; ntype.declare = file_ns::node_declare; nodeRegisterType(&ntype); diff --git a/source/blender/nodes/geometry/nodes/node_geo_input_spline_resolution.cc b/source/blender/nodes/geometry/nodes/node_geo_input_spline_resolution.cc index 77b6e27e6a2..d79f2ffd64d 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_input_spline_resolution.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_input_spline_resolution.cc @@ -38,7 +38,7 @@ void register_node_type_geo_input_spline_resolution() static bNodeType ntype; geo_node_type_base( - &ntype, GEO_NODE_INPUT_SPLINE_RESOLUTION, "Spline Resolution", NODE_CLASS_INPUT, 0); + &ntype, GEO_NODE_INPUT_SPLINE_RESOLUTION, "Spline Resolution", NODE_CLASS_INPUT); ntype.geometry_node_execute = file_ns::node_geo_exec; ntype.declare = file_ns::node_declare; nodeRegisterType(&ntype); diff --git a/source/blender/nodes/geometry/nodes/node_geo_input_tangent.cc b/source/blender/nodes/geometry/nodes/node_geo_input_tangent.cc index 86f882df3cd..f80fdfbf334 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_input_tangent.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_input_tangent.cc @@ -161,7 +161,7 @@ void register_node_type_geo_input_tangent() static bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_INPUT_TANGENT, "Curve Tangent", NODE_CLASS_INPUT, 0); + geo_node_type_base(&ntype, GEO_NODE_INPUT_TANGENT, "Curve Tangent", NODE_CLASS_INPUT); ntype.geometry_node_execute = file_ns::node_geo_exec; ntype.declare = file_ns::node_declare; nodeRegisterType(&ntype); diff --git a/source/blender/nodes/geometry/nodes/node_geo_instance_on_points.cc b/source/blender/nodes/geometry/nodes/node_geo_instance_on_points.cc index 486f90760f5..66ac618be5f 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_instance_on_points.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_instance_on_points.cc @@ -259,7 +259,7 @@ void register_node_type_geo_instance_on_points() static bNodeType ntype; geo_node_type_base( - &ntype, GEO_NODE_INSTANCE_ON_POINTS, "Instance on Points", NODE_CLASS_GEOMETRY, 0); + &ntype, GEO_NODE_INSTANCE_ON_POINTS, "Instance on Points", NODE_CLASS_GEOMETRY); ntype.declare = file_ns::node_declare; ntype.geometry_node_execute = file_ns::node_geo_exec; nodeRegisterType(&ntype); diff --git a/source/blender/nodes/geometry/nodes/node_geo_instances_to_points.cc b/source/blender/nodes/geometry/nodes/node_geo_instances_to_points.cc index 9942e388ba5..f9beed956bb 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_instances_to_points.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_instances_to_points.cc @@ -130,7 +130,7 @@ void register_node_type_geo_instances_to_points() static bNodeType ntype; geo_node_type_base( - &ntype, GEO_NODE_INSTANCES_TO_POINTS, "Instances to Points", NODE_CLASS_GEOMETRY, 0); + &ntype, GEO_NODE_INSTANCES_TO_POINTS, "Instances to Points", NODE_CLASS_GEOMETRY); ntype.declare = file_ns::node_declare; ntype.geometry_node_execute = file_ns::node_geo_exec; nodeRegisterType(&ntype); diff --git a/source/blender/nodes/geometry/nodes/node_geo_is_viewport.cc b/source/blender/nodes/geometry/nodes/node_geo_is_viewport.cc index 5925d440317..c97bbad4665 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_is_viewport.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_is_viewport.cc @@ -42,7 +42,7 @@ void register_node_type_geo_is_viewport() static bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_IS_VIEWPORT, "Is Viewport", NODE_CLASS_INPUT, 0); + geo_node_type_base(&ntype, GEO_NODE_IS_VIEWPORT, "Is Viewport", NODE_CLASS_INPUT); ntype.geometry_node_execute = file_ns::node_geo_exec; ntype.declare = file_ns::node_declare; nodeRegisterType(&ntype); diff --git a/source/blender/nodes/geometry/nodes/node_geo_join_geometry.cc b/source/blender/nodes/geometry/nodes/node_geo_join_geometry.cc index 1d483709a0a..1e521af6b13 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_join_geometry.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_join_geometry.cc @@ -220,7 +220,7 @@ void register_node_type_geo_join_geometry() static bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_JOIN_GEOMETRY, "Join Geometry", NODE_CLASS_GEOMETRY, 0); + geo_node_type_base(&ntype, GEO_NODE_JOIN_GEOMETRY, "Join Geometry", NODE_CLASS_GEOMETRY); ntype.geometry_node_execute = file_ns::node_geo_exec; ntype.declare = file_ns::node_declare; nodeRegisterType(&ntype); diff --git a/source/blender/nodes/geometry/nodes/node_geo_material_replace.cc b/source/blender/nodes/geometry/nodes/node_geo_material_replace.cc index 5a334126350..0309121db74 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_material_replace.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_material_replace.cc @@ -63,8 +63,7 @@ void register_node_type_geo_material_replace() static bNodeType ntype; - geo_node_type_base( - &ntype, GEO_NODE_REPLACE_MATERIAL, "Replace Material", NODE_CLASS_GEOMETRY, 0); + geo_node_type_base(&ntype, GEO_NODE_REPLACE_MATERIAL, "Replace Material", NODE_CLASS_GEOMETRY); ntype.declare = file_ns::node_declare; ntype.geometry_node_execute = file_ns::node_geo_exec; nodeRegisterType(&ntype); diff --git a/source/blender/nodes/geometry/nodes/node_geo_material_selection.cc b/source/blender/nodes/geometry/nodes/node_geo_material_selection.cc index 2aad68e7c25..0b5f0bf34c5 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_material_selection.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_material_selection.cc @@ -122,7 +122,7 @@ void register_node_type_geo_material_selection() static bNodeType ntype; geo_node_type_base( - &ntype, GEO_NODE_MATERIAL_SELECTION, "Material Selection", NODE_CLASS_GEOMETRY, 0); + &ntype, GEO_NODE_MATERIAL_SELECTION, "Material Selection", NODE_CLASS_GEOMETRY); ntype.declare = file_ns::node_declare; ntype.geometry_node_execute = file_ns::node_geo_exec; nodeRegisterType(&ntype); diff --git a/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_circle.cc b/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_circle.cc index 503915872d6..b07d809a091 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_circle.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_circle.cc @@ -224,8 +224,7 @@ void register_node_type_geo_mesh_primitive_circle() static bNodeType ntype; - geo_node_type_base( - &ntype, GEO_NODE_MESH_PRIMITIVE_CIRCLE, "Mesh Circle", NODE_CLASS_GEOMETRY, 0); + geo_node_type_base(&ntype, GEO_NODE_MESH_PRIMITIVE_CIRCLE, "Mesh Circle", NODE_CLASS_GEOMETRY); node_type_init(&ntype, file_ns::node_init); node_type_storage( &ntype, "NodeGeometryMeshCircle", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_cone.cc b/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_cone.cc index b6ddbb4dd27..2aa9522cf56 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_cone.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_cone.cc @@ -878,7 +878,7 @@ void register_node_type_geo_mesh_primitive_cone() static bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_MESH_PRIMITIVE_CONE, "Cone", NODE_CLASS_GEOMETRY, 0); + geo_node_type_base(&ntype, GEO_NODE_MESH_PRIMITIVE_CONE, "Cone", NODE_CLASS_GEOMETRY); node_type_init(&ntype, file_ns::node_init); node_type_update(&ntype, file_ns::node_update); node_type_storage( diff --git a/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_cube.cc b/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_cube.cc index 2542542c919..e90a9eb393b 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_cube.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_cube.cc @@ -527,7 +527,7 @@ void register_node_type_geo_mesh_primitive_cube() static bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_MESH_PRIMITIVE_CUBE, "Cube", NODE_CLASS_GEOMETRY, 0); + geo_node_type_base(&ntype, GEO_NODE_MESH_PRIMITIVE_CUBE, "Cube", NODE_CLASS_GEOMETRY); ntype.declare = file_ns::node_declare; ntype.geometry_node_execute = file_ns::node_geo_exec; nodeRegisterType(&ntype); diff --git a/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_cylinder.cc b/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_cylinder.cc index ae270495b07..73f21cf31fa 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_cylinder.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_cylinder.cc @@ -167,7 +167,7 @@ void register_node_type_geo_mesh_primitive_cylinder() namespace file_ns = blender::nodes::node_geo_mesh_primitive_cylinder_cc; static bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_MESH_PRIMITIVE_CYLINDER, "Cylinder", NODE_CLASS_GEOMETRY, 0); + geo_node_type_base(&ntype, GEO_NODE_MESH_PRIMITIVE_CYLINDER, "Cylinder", NODE_CLASS_GEOMETRY); node_type_init(&ntype, file_ns::node_init); node_type_update(&ntype, file_ns::node_update); node_type_storage( diff --git a/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_grid.cc b/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_grid.cc index 4a5668453bf..2c4b5df6030 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_grid.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_grid.cc @@ -225,7 +225,7 @@ void register_node_type_geo_mesh_primitive_grid() static bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_MESH_PRIMITIVE_GRID, "Grid", NODE_CLASS_GEOMETRY, 0); + geo_node_type_base(&ntype, GEO_NODE_MESH_PRIMITIVE_GRID, "Grid", NODE_CLASS_GEOMETRY); ntype.declare = file_ns::node_declare; ntype.geometry_node_execute = file_ns::node_geo_exec; nodeRegisterType(&ntype); diff --git a/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_ico_sphere.cc b/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_ico_sphere.cc index 5f483a95063..28a505c5bb8 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_ico_sphere.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_ico_sphere.cc @@ -87,7 +87,7 @@ void register_node_type_geo_mesh_primitive_ico_sphere() static bNodeType ntype; geo_node_type_base( - &ntype, GEO_NODE_MESH_PRIMITIVE_ICO_SPHERE, "Ico Sphere", NODE_CLASS_GEOMETRY, 0); + &ntype, GEO_NODE_MESH_PRIMITIVE_ICO_SPHERE, "Ico Sphere", NODE_CLASS_GEOMETRY); ntype.declare = file_ns::node_declare; ntype.geometry_node_execute = file_ns::node_geo_exec; nodeRegisterType(&ntype); diff --git a/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_line.cc b/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_line.cc index 29f1e62b820..5116e78fdda 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_line.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_line.cc @@ -224,7 +224,7 @@ void register_node_type_geo_mesh_primitive_line() static bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_MESH_PRIMITIVE_LINE, "Mesh Line", NODE_CLASS_GEOMETRY, 0); + geo_node_type_base(&ntype, GEO_NODE_MESH_PRIMITIVE_LINE, "Mesh Line", NODE_CLASS_GEOMETRY); ntype.declare = file_ns::node_declare; node_type_init(&ntype, file_ns::node_init); node_type_update(&ntype, file_ns::node_update); diff --git a/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_uv_sphere.cc b/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_uv_sphere.cc index f3213f791de..373e6bfdd18 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_uv_sphere.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_uv_sphere.cc @@ -319,8 +319,7 @@ void register_node_type_geo_mesh_primitive_uv_sphere() static bNodeType ntype; - geo_node_type_base( - &ntype, GEO_NODE_MESH_PRIMITIVE_UV_SPHERE, "UV Sphere", NODE_CLASS_GEOMETRY, 0); + geo_node_type_base(&ntype, GEO_NODE_MESH_PRIMITIVE_UV_SPHERE, "UV Sphere", NODE_CLASS_GEOMETRY); ntype.declare = file_ns::node_declare; ntype.geometry_node_execute = file_ns::node_geo_exec; nodeRegisterType(&ntype); diff --git a/source/blender/nodes/geometry/nodes/node_geo_mesh_subdivide.cc b/source/blender/nodes/geometry/nodes/node_geo_mesh_subdivide.cc index 1ec9808044f..6d8a2fac8ad 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_mesh_subdivide.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_mesh_subdivide.cc @@ -105,7 +105,7 @@ void register_node_type_geo_mesh_subdivide() static bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_SUBDIVIDE_MESH, "Subdivide Mesh", NODE_CLASS_GEOMETRY, 0); + geo_node_type_base(&ntype, GEO_NODE_SUBDIVIDE_MESH, "Subdivide Mesh", NODE_CLASS_GEOMETRY); ntype.declare = file_ns::node_declare; ntype.geometry_node_execute = file_ns::node_geo_exec; nodeRegisterType(&ntype); diff --git a/source/blender/nodes/geometry/nodes/node_geo_mesh_to_curve.cc b/source/blender/nodes/geometry/nodes/node_geo_mesh_to_curve.cc index 90f0af75788..0f0fb3c230a 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_mesh_to_curve.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_mesh_to_curve.cc @@ -64,7 +64,7 @@ void register_node_type_geo_mesh_to_curve() static bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_MESH_TO_CURVE, "Mesh to Curve", NODE_CLASS_GEOMETRY, 0); + geo_node_type_base(&ntype, GEO_NODE_MESH_TO_CURVE, "Mesh to Curve", NODE_CLASS_GEOMETRY); ntype.declare = file_ns::node_declare; ntype.geometry_node_execute = file_ns::node_geo_exec; nodeRegisterType(&ntype); diff --git a/source/blender/nodes/geometry/nodes/node_geo_mesh_to_points.cc b/source/blender/nodes/geometry/nodes/node_geo_mesh_to_points.cc index 384ab43751f..d0546cd2583 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_mesh_to_points.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_mesh_to_points.cc @@ -178,7 +178,7 @@ void register_node_type_geo_mesh_to_points() static bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_MESH_TO_POINTS, "Mesh to Points", NODE_CLASS_GEOMETRY, 0); + geo_node_type_base(&ntype, GEO_NODE_MESH_TO_POINTS, "Mesh to Points", NODE_CLASS_GEOMETRY); ntype.declare = file_ns::node_declare; ntype.geometry_node_execute = file_ns::node_geo_exec; node_type_init(&ntype, file_ns::node_init); diff --git a/source/blender/nodes/geometry/nodes/node_geo_object_info.cc b/source/blender/nodes/geometry/nodes/node_geo_object_info.cc index aeef6730b47..d32875d2627 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_object_info.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_object_info.cc @@ -115,7 +115,7 @@ void register_node_type_geo_object_info() static bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_OBJECT_INFO, "Object Info", NODE_CLASS_INPUT, 0); + geo_node_type_base(&ntype, GEO_NODE_OBJECT_INFO, "Object Info", NODE_CLASS_INPUT); node_type_init(&ntype, file_ns::node_node_init); node_type_storage( &ntype, "NodeGeometryObjectInfo", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/geometry/nodes/node_geo_points_to_vertices.cc b/source/blender/nodes/geometry/nodes/node_geo_points_to_vertices.cc index 5510773eabd..f3da591f684 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_points_to_vertices.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_points_to_vertices.cc @@ -113,7 +113,7 @@ void register_node_type_geo_points_to_vertices() static bNodeType ntype; geo_node_type_base( - &ntype, GEO_NODE_POINTS_TO_VERTICES, "Points to Vertices", NODE_CLASS_GEOMETRY, 0); + &ntype, GEO_NODE_POINTS_TO_VERTICES, "Points to Vertices", NODE_CLASS_GEOMETRY); ntype.declare = file_ns::node_declare; ntype.geometry_node_execute = file_ns::node_geo_exec; nodeRegisterType(&ntype); diff --git a/source/blender/nodes/geometry/nodes/node_geo_points_to_volume.cc b/source/blender/nodes/geometry/nodes/node_geo_points_to_volume.cc index 351e0881fd4..dda4543d5e1 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_points_to_volume.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_points_to_volume.cc @@ -269,8 +269,7 @@ void register_node_type_geo_points_to_volume() static bNodeType ntype; - geo_node_type_base( - &ntype, GEO_NODE_POINTS_TO_VOLUME, "Points to Volume", NODE_CLASS_GEOMETRY, 0); + geo_node_type_base(&ntype, GEO_NODE_POINTS_TO_VOLUME, "Points to Volume", NODE_CLASS_GEOMETRY); node_type_storage(&ntype, "NodeGeometryPointsToVolume", node_free_standard_storage, diff --git a/source/blender/nodes/geometry/nodes/node_geo_proximity.cc b/source/blender/nodes/geometry/nodes/node_geo_proximity.cc index 49be56acd16..e0117c4726d 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_proximity.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_proximity.cc @@ -238,7 +238,7 @@ void register_node_type_geo_proximity() static bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_PROXIMITY, "Geometry Proximity", NODE_CLASS_GEOMETRY, 0); + geo_node_type_base(&ntype, GEO_NODE_PROXIMITY, "Geometry Proximity", NODE_CLASS_GEOMETRY); node_type_init(&ntype, file_ns::geo_proximity_init); node_type_storage( &ntype, "NodeGeometryProximity", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/geometry/nodes/node_geo_raycast.cc b/source/blender/nodes/geometry/nodes/node_geo_raycast.cc index 82e96267a11..2c35ca0afc9 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_raycast.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_raycast.cc @@ -448,7 +448,7 @@ void register_node_type_geo_raycast() static bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_RAYCAST, "Raycast", NODE_CLASS_GEOMETRY, 0); + geo_node_type_base(&ntype, GEO_NODE_RAYCAST, "Raycast", NODE_CLASS_GEOMETRY); node_type_size_preset(&ntype, NODE_SIZE_MIDDLE); node_type_init(&ntype, file_ns::node_init); node_type_update(&ntype, file_ns::node_update); diff --git a/source/blender/nodes/geometry/nodes/node_geo_realize_instances.cc b/source/blender/nodes/geometry/nodes/node_geo_realize_instances.cc index fad35389823..48b88705ed2 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_realize_instances.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_realize_instances.cc @@ -54,8 +54,7 @@ void register_node_type_geo_realize_instances() static bNodeType ntype; - geo_node_type_base( - &ntype, GEO_NODE_REALIZE_INSTANCES, "Realize Instances", NODE_CLASS_GEOMETRY, 0); + geo_node_type_base(&ntype, GEO_NODE_REALIZE_INSTANCES, "Realize Instances", NODE_CLASS_GEOMETRY); ntype.declare = file_ns::node_declare; ntype.draw_buttons_ex = file_ns::node_layout; ntype.geometry_node_execute = file_ns::node_geo_exec; diff --git a/source/blender/nodes/geometry/nodes/node_geo_rotate_instances.cc b/source/blender/nodes/geometry/nodes/node_geo_rotate_instances.cc index 335484c62b0..5a088e16221 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_rotate_instances.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_rotate_instances.cc @@ -112,8 +112,7 @@ void register_node_type_geo_rotate_instances() static bNodeType ntype; - geo_node_type_base( - &ntype, GEO_NODE_ROTATE_INSTANCES, "Rotate Instances", NODE_CLASS_GEOMETRY, 0); + geo_node_type_base(&ntype, GEO_NODE_ROTATE_INSTANCES, "Rotate Instances", NODE_CLASS_GEOMETRY); ntype.geometry_node_execute = file_ns::node_geo_exec; ntype.declare = file_ns::node_declare; nodeRegisterType(&ntype); diff --git a/source/blender/nodes/geometry/nodes/node_geo_scale_instances.cc b/source/blender/nodes/geometry/nodes/node_geo_scale_instances.cc index 1779ac8bff7..04c4e097f8d 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_scale_instances.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_scale_instances.cc @@ -91,7 +91,7 @@ void register_node_type_geo_scale_instances() static bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_SCALE_INSTANCES, "Scale Instances", NODE_CLASS_GEOMETRY, 0); + geo_node_type_base(&ntype, GEO_NODE_SCALE_INSTANCES, "Scale Instances", NODE_CLASS_GEOMETRY); ntype.geometry_node_execute = file_ns::node_geo_exec; ntype.declare = file_ns::node_declare; nodeRegisterType(&ntype); diff --git a/source/blender/nodes/geometry/nodes/node_geo_separate_components.cc b/source/blender/nodes/geometry/nodes/node_geo_separate_components.cc index e4adfe6587d..3e34378d3e0 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_separate_components.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_separate_components.cc @@ -70,7 +70,7 @@ void register_node_type_geo_separate_components() static bNodeType ntype; geo_node_type_base( - &ntype, GEO_NODE_SEPARATE_COMPONENTS, "Separate Components", NODE_CLASS_GEOMETRY, 0); + &ntype, GEO_NODE_SEPARATE_COMPONENTS, "Separate Components", NODE_CLASS_GEOMETRY); ntype.declare = file_ns::node_declare; ntype.geometry_node_execute = file_ns::node_geo_exec; nodeRegisterType(&ntype); diff --git a/source/blender/nodes/geometry/nodes/node_geo_separate_geometry.cc b/source/blender/nodes/geometry/nodes/node_geo_separate_geometry.cc index 57e5eb63157..844d3c88e36 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_separate_geometry.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_separate_geometry.cc @@ -101,8 +101,7 @@ void register_node_type_geo_separate_geometry() static bNodeType ntype; - geo_node_type_base( - &ntype, GEO_NODE_SEPARATE_GEOMETRY, "Separate Geometry", NODE_CLASS_GEOMETRY, 0); + geo_node_type_base(&ntype, GEO_NODE_SEPARATE_GEOMETRY, "Separate Geometry", NODE_CLASS_GEOMETRY); node_type_storage(&ntype, "NodeGeometrySeparateGeometry", diff --git a/source/blender/nodes/geometry/nodes/node_geo_set_curve_handles.cc b/source/blender/nodes/geometry/nodes/node_geo_set_curve_handles.cc index bf8c71e1c91..feab0a6743f 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_set_curve_handles.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_set_curve_handles.cc @@ -167,7 +167,7 @@ void register_node_type_geo_set_curve_handles() static bNodeType ntype; geo_node_type_base( - &ntype, GEO_NODE_SET_CURVE_HANDLES, "Set Handle Positions", NODE_CLASS_GEOMETRY, 0); + &ntype, GEO_NODE_SET_CURVE_HANDLES, "Set Handle Positions", NODE_CLASS_GEOMETRY); ntype.geometry_node_execute = file_ns::node_geo_exec; ntype.declare = file_ns::node_declare; ntype.minwidth = 100.0f; diff --git a/source/blender/nodes/geometry/nodes/node_geo_set_curve_radius.cc b/source/blender/nodes/geometry/nodes/node_geo_set_curve_radius.cc index 7d99f42c487..06fe4427520 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_set_curve_radius.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_set_curve_radius.cc @@ -75,8 +75,7 @@ void register_node_type_geo_set_curve_radius() static bNodeType ntype; - geo_node_type_base( - &ntype, GEO_NODE_SET_CURVE_RADIUS, "Set Curve Radius", NODE_CLASS_GEOMETRY, 0); + geo_node_type_base(&ntype, GEO_NODE_SET_CURVE_RADIUS, "Set Curve Radius", NODE_CLASS_GEOMETRY); ntype.geometry_node_execute = file_ns::node_geo_exec; ntype.declare = file_ns::node_declare; nodeRegisterType(&ntype); diff --git a/source/blender/nodes/geometry/nodes/node_geo_set_curve_tilt.cc b/source/blender/nodes/geometry/nodes/node_geo_set_curve_tilt.cc index 447310e1ad7..0854d0a4549 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_set_curve_tilt.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_set_curve_tilt.cc @@ -71,7 +71,7 @@ void register_node_type_geo_set_curve_tilt() static bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_SET_CURVE_TILT, "Set Curve Tilt", NODE_CLASS_GEOMETRY, 0); + geo_node_type_base(&ntype, GEO_NODE_SET_CURVE_TILT, "Set Curve Tilt", NODE_CLASS_GEOMETRY); ntype.geometry_node_execute = file_ns::node_geo_exec; ntype.declare = file_ns::node_declare; nodeRegisterType(&ntype); diff --git a/source/blender/nodes/geometry/nodes/node_geo_set_id.cc b/source/blender/nodes/geometry/nodes/node_geo_set_id.cc index db4083acd4b..110b8206944 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_set_id.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_set_id.cc @@ -87,7 +87,7 @@ void register_node_type_geo_set_id() static bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_SET_ID, "Set ID", NODE_CLASS_GEOMETRY, 0); + geo_node_type_base(&ntype, GEO_NODE_SET_ID, "Set ID", NODE_CLASS_GEOMETRY); ntype.geometry_node_execute = file_ns::node_geo_exec; ntype.declare = file_ns::node_declare; nodeRegisterType(&ntype); diff --git a/source/blender/nodes/geometry/nodes/node_geo_set_material.cc b/source/blender/nodes/geometry/nodes/node_geo_set_material.cc index 0e30522296f..ab2c778d6fc 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_set_material.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_set_material.cc @@ -127,7 +127,7 @@ void register_node_type_geo_set_material() static bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_SET_MATERIAL, "Set Material", NODE_CLASS_GEOMETRY, 0); + geo_node_type_base(&ntype, GEO_NODE_SET_MATERIAL, "Set Material", NODE_CLASS_GEOMETRY); ntype.declare = file_ns::node_declare; ntype.geometry_node_execute = file_ns::node_geo_exec; nodeRegisterType(&ntype); diff --git a/source/blender/nodes/geometry/nodes/node_geo_set_material_index.cc b/source/blender/nodes/geometry/nodes/node_geo_set_material_index.cc index 4451907132a..ca6d78adc80 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_set_material_index.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_set_material_index.cc @@ -70,7 +70,7 @@ void register_node_type_geo_set_material_index() static bNodeType ntype; geo_node_type_base( - &ntype, GEO_NODE_SET_MATERIAL_INDEX, "Set Material Index", NODE_CLASS_GEOMETRY, 0); + &ntype, GEO_NODE_SET_MATERIAL_INDEX, "Set Material Index", NODE_CLASS_GEOMETRY); ntype.geometry_node_execute = file_ns::node_geo_exec; ntype.declare = file_ns::node_declare; nodeRegisterType(&ntype); diff --git a/source/blender/nodes/geometry/nodes/node_geo_set_point_radius.cc b/source/blender/nodes/geometry/nodes/node_geo_set_point_radius.cc index 98adff7c939..b7dd091da44 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_set_point_radius.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_set_point_radius.cc @@ -76,8 +76,7 @@ void register_node_type_geo_set_point_radius() static bNodeType ntype; - geo_node_type_base( - &ntype, GEO_NODE_SET_POINT_RADIUS, "Set Point Radius", NODE_CLASS_GEOMETRY, 0); + geo_node_type_base(&ntype, GEO_NODE_SET_POINT_RADIUS, "Set Point Radius", NODE_CLASS_GEOMETRY); ntype.geometry_node_execute = file_ns::node_geo_exec; ntype.declare = file_ns::node_declare; nodeRegisterType(&ntype); diff --git a/source/blender/nodes/geometry/nodes/node_geo_set_position.cc b/source/blender/nodes/geometry/nodes/node_geo_set_position.cc index 93073c2436d..4a8e4e6eab8 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_set_position.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_set_position.cc @@ -159,7 +159,7 @@ void register_node_type_geo_set_position() static bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_SET_POSITION, "Set Position", NODE_CLASS_GEOMETRY, 0); + geo_node_type_base(&ntype, GEO_NODE_SET_POSITION, "Set Position", NODE_CLASS_GEOMETRY); ntype.geometry_node_execute = file_ns::node_geo_exec; ntype.declare = file_ns::node_declare; nodeRegisterType(&ntype); diff --git a/source/blender/nodes/geometry/nodes/node_geo_set_shade_smooth.cc b/source/blender/nodes/geometry/nodes/node_geo_set_shade_smooth.cc index 879a868cc0e..d442cd37e81 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_set_shade_smooth.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_set_shade_smooth.cc @@ -70,8 +70,7 @@ void register_node_type_geo_set_shade_smooth() static bNodeType ntype; - geo_node_type_base( - &ntype, GEO_NODE_SET_SHADE_SMOOTH, "Set Shade Smooth", NODE_CLASS_GEOMETRY, 0); + geo_node_type_base(&ntype, GEO_NODE_SET_SHADE_SMOOTH, "Set Shade Smooth", NODE_CLASS_GEOMETRY); ntype.geometry_node_execute = file_ns::node_geo_exec; ntype.declare = file_ns::node_declare; nodeRegisterType(&ntype); diff --git a/source/blender/nodes/geometry/nodes/node_geo_set_spline_cyclic.cc b/source/blender/nodes/geometry/nodes/node_geo_set_spline_cyclic.cc index 694491d7e6d..13230e185a3 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_set_spline_cyclic.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_set_spline_cyclic.cc @@ -71,8 +71,7 @@ void register_node_type_geo_set_spline_cyclic() static bNodeType ntype; - geo_node_type_base( - &ntype, GEO_NODE_SET_SPLINE_CYCLIC, "Set Spline Cyclic", NODE_CLASS_GEOMETRY, 0); + geo_node_type_base(&ntype, GEO_NODE_SET_SPLINE_CYCLIC, "Set Spline Cyclic", NODE_CLASS_GEOMETRY); ntype.geometry_node_execute = file_ns::node_geo_exec; ntype.declare = file_ns::node_declare; nodeRegisterType(&ntype); diff --git a/source/blender/nodes/geometry/nodes/node_geo_set_spline_resolution.cc b/source/blender/nodes/geometry/nodes/node_geo_set_spline_resolution.cc index 0f93db5e6f6..e472e14671c 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_set_spline_resolution.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_set_spline_resolution.cc @@ -88,7 +88,7 @@ void register_node_type_geo_set_spline_resolution() static bNodeType ntype; geo_node_type_base( - &ntype, GEO_NODE_SET_SPLINE_RESOLUTION, "Set Spline Resolution", NODE_CLASS_GEOMETRY, 0); + &ntype, GEO_NODE_SET_SPLINE_RESOLUTION, "Set Spline Resolution", NODE_CLASS_GEOMETRY); ntype.geometry_node_execute = file_ns::node_geo_exec; ntype.declare = file_ns::node_declare; nodeRegisterType(&ntype); diff --git a/source/blender/nodes/geometry/nodes/node_geo_string_join.cc b/source/blender/nodes/geometry/nodes/node_geo_string_join.cc index 5308b43afb2..0fbe9a41ca5 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_string_join.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_string_join.cc @@ -48,7 +48,7 @@ void register_node_type_geo_string_join() static bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_STRING_JOIN, "Join Strings", NODE_CLASS_CONVERTER, 0); + geo_node_type_base(&ntype, GEO_NODE_STRING_JOIN, "Join Strings", NODE_CLASS_CONVERTER); ntype.geometry_node_execute = file_ns::node_geo_exec; ntype.declare = file_ns::node_declare; nodeRegisterType(&ntype); diff --git a/source/blender/nodes/geometry/nodes/node_geo_string_to_curves.cc b/source/blender/nodes/geometry/nodes/node_geo_string_to_curves.cc index 910dfe261e8..68d62a842e6 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_string_to_curves.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_string_to_curves.cc @@ -310,8 +310,7 @@ void register_node_type_geo_string_to_curves() static bNodeType ntype; - geo_node_type_base( - &ntype, GEO_NODE_STRING_TO_CURVES, "String to Curves", NODE_CLASS_GEOMETRY, 0); + geo_node_type_base(&ntype, GEO_NODE_STRING_TO_CURVES, "String to Curves", NODE_CLASS_GEOMETRY); ntype.declare = file_ns::node_declare; ntype.geometry_node_execute = file_ns::node_geo_exec; node_type_init(&ntype, file_ns::node_init); diff --git a/source/blender/nodes/geometry/nodes/node_geo_subdivision_surface.cc b/source/blender/nodes/geometry/nodes/node_geo_subdivision_surface.cc index f5694ab10af..eb1a5496845 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_subdivision_surface.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_subdivision_surface.cc @@ -152,7 +152,7 @@ void register_node_type_geo_subdivision_surface() static bNodeType ntype; geo_node_type_base( - &ntype, GEO_NODE_SUBDIVISION_SURFACE, "Subdivision Surface", NODE_CLASS_GEOMETRY, 0); + &ntype, GEO_NODE_SUBDIVISION_SURFACE, "Subdivision Surface", NODE_CLASS_GEOMETRY); ntype.declare = file_ns::node_declare; ntype.geometry_node_execute = file_ns::node_geo_exec; ntype.draw_buttons = file_ns::node_layout; diff --git a/source/blender/nodes/geometry/nodes/node_geo_switch.cc b/source/blender/nodes/geometry/nodes/node_geo_switch.cc index 91aa1432ee2..a2f05677310 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_switch.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_switch.cc @@ -327,7 +327,7 @@ void register_node_type_geo_switch() static bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_SWITCH, "Switch", NODE_CLASS_CONVERTER, 0); + geo_node_type_base(&ntype, GEO_NODE_SWITCH, "Switch", NODE_CLASS_CONVERTER); ntype.declare = file_ns::node_declare; node_type_init(&ntype, file_ns::node_init); node_type_update(&ntype, file_ns::node_update); diff --git a/source/blender/nodes/geometry/nodes/node_geo_transfer_attribute.cc b/source/blender/nodes/geometry/nodes/node_geo_transfer_attribute.cc index 285f7c6d42d..331460296a6 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_transfer_attribute.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_transfer_attribute.cc @@ -827,7 +827,7 @@ void register_node_type_geo_transfer_attribute() static bNodeType ntype; geo_node_type_base( - &ntype, GEO_NODE_TRANSFER_ATTRIBUTE, "Transfer Attribute", NODE_CLASS_ATTRIBUTE, 0); + &ntype, GEO_NODE_TRANSFER_ATTRIBUTE, "Transfer Attribute", NODE_CLASS_ATTRIBUTE); node_type_init(&ntype, file_ns::node_init); node_type_update(&ntype, file_ns::node_update); node_type_storage(&ntype, diff --git a/source/blender/nodes/geometry/nodes/node_geo_transform.cc b/source/blender/nodes/geometry/nodes/node_geo_transform.cc index 8322de20d20..7f866ea6f4a 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_transform.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_transform.cc @@ -226,7 +226,7 @@ void register_node_type_geo_transform() static bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_TRANSFORM, "Transform", NODE_CLASS_GEOMETRY, 0); + geo_node_type_base(&ntype, GEO_NODE_TRANSFORM, "Transform", NODE_CLASS_GEOMETRY); ntype.declare = file_ns::node_declare; ntype.geometry_node_execute = file_ns::node_geo_exec; nodeRegisterType(&ntype); diff --git a/source/blender/nodes/geometry/nodes/node_geo_translate_instances.cc b/source/blender/nodes/geometry/nodes/node_geo_translate_instances.cc index 59049ecf0ed..1061ece49a9 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_translate_instances.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_translate_instances.cc @@ -77,7 +77,7 @@ void register_node_type_geo_translate_instances() static bNodeType ntype; geo_node_type_base( - &ntype, GEO_NODE_TRANSLATE_INSTANCES, "Translate Instances", NODE_CLASS_GEOMETRY, 0); + &ntype, GEO_NODE_TRANSLATE_INSTANCES, "Translate Instances", NODE_CLASS_GEOMETRY); ntype.geometry_node_execute = file_ns::node_geo_exec; ntype.declare = file_ns::node_declare; nodeRegisterType(&ntype); diff --git a/source/blender/nodes/geometry/nodes/node_geo_triangulate.cc b/source/blender/nodes/geometry/nodes/node_geo_triangulate.cc index f8deaaa4a14..998e4d58bf3 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_triangulate.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_triangulate.cc @@ -77,7 +77,7 @@ void register_node_type_geo_triangulate() static bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_TRIANGULATE, "Triangulate", NODE_CLASS_GEOMETRY, 0); + geo_node_type_base(&ntype, GEO_NODE_TRIANGULATE, "Triangulate", NODE_CLASS_GEOMETRY); ntype.declare = file_ns::node_declare; node_type_init(&ntype, file_ns::geo_triangulate_init); ntype.geometry_node_execute = file_ns::node_geo_exec; diff --git a/source/blender/nodes/geometry/nodes/node_geo_viewer.cc b/source/blender/nodes/geometry/nodes/node_geo_viewer.cc index 6110ee42eea..c717d90f7cc 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_viewer.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_viewer.cc @@ -140,7 +140,7 @@ void register_node_type_geo_viewer() static bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_VIEWER, "Viewer", NODE_CLASS_OUTPUT, 0); + geo_node_type_base(&ntype, GEO_NODE_VIEWER, "Viewer", NODE_CLASS_OUTPUT); node_type_storage( &ntype, "NodeGeometryViewer", node_free_standard_storage, node_copy_standard_storage); node_type_update(&ntype, file_ns::node_update); diff --git a/source/blender/nodes/geometry/nodes/node_geo_volume_to_mesh.cc b/source/blender/nodes/geometry/nodes/node_geo_volume_to_mesh.cc index 94e1dbfa4ad..c7dc73f8a91 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_volume_to_mesh.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_volume_to_mesh.cc @@ -214,7 +214,7 @@ void register_node_type_geo_volume_to_mesh() static bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_VOLUME_TO_MESH, "Volume to Mesh", NODE_CLASS_GEOMETRY, 0); + geo_node_type_base(&ntype, GEO_NODE_VOLUME_TO_MESH, "Volume to Mesh", NODE_CLASS_GEOMETRY); ntype.declare = file_ns::node_declare; node_type_storage( &ntype, "NodeGeometryVolumeToMesh", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/intern/node_common.cc b/source/blender/nodes/intern/node_common.cc index 99bcdcbbba8..1c9a1730635 100644 --- a/source/blender/nodes/intern/node_common.cc +++ b/source/blender/nodes/intern/node_common.cc @@ -238,10 +238,11 @@ void register_node_type_frame() bNodeType *ntype = MEM_cnew<bNodeType>("frame node type"); ntype->free_self = (void (*)(bNodeType *))MEM_freeN; - node_type_base(ntype, NODE_FRAME, "Frame", NODE_CLASS_LAYOUT, NODE_BACKGROUND); + node_type_base(ntype, NODE_FRAME, "Frame", NODE_CLASS_LAYOUT); node_type_init(ntype, node_frame_init); node_type_storage(ntype, "NodeFrame", node_free_standard_storage, node_copy_standard_storage); node_type_size(ntype, 150, 100, 0); + ntype->flag |= NODE_BACKGROUND; nodeRegisterType(ntype); } @@ -267,7 +268,7 @@ void register_node_type_reroute() bNodeType *ntype = MEM_cnew<bNodeType>("frame node type"); ntype->free_self = (void (*)(bNodeType *))MEM_freeN; - node_type_base(ntype, NODE_REROUTE, "Reroute", NODE_CLASS_LAYOUT, 0); + node_type_base(ntype, NODE_REROUTE, "Reroute", NODE_CLASS_LAYOUT); node_type_init(ntype, node_reroute_init); nodeRegisterType(ntype); @@ -508,7 +509,7 @@ void register_node_type_group_input() bNodeType *ntype = MEM_cnew<bNodeType>("node type"); ntype->free_self = (void (*)(bNodeType *))MEM_freeN; - node_type_base(ntype, NODE_GROUP_INPUT, "Group Input", NODE_CLASS_INTERFACE, 0); + node_type_base(ntype, NODE_GROUP_INPUT, "Group Input", NODE_CLASS_INTERFACE); node_type_size(ntype, 140, 80, 400); node_type_init(ntype, node_group_input_init); node_type_update(ntype, node_group_input_update); @@ -606,7 +607,7 @@ void register_node_type_group_output() bNodeType *ntype = MEM_cnew<bNodeType>("node type"); ntype->free_self = (void (*)(bNodeType *))MEM_freeN; - node_type_base(ntype, NODE_GROUP_OUTPUT, "Group Output", NODE_CLASS_INTERFACE, 0); + node_type_base(ntype, NODE_GROUP_OUTPUT, "Group Output", NODE_CLASS_INTERFACE); node_type_size(ntype, 140, 80, 400); node_type_init(ntype, node_group_output_init); node_type_update(ntype, node_group_output_update); diff --git a/source/blender/nodes/shader/CMakeLists.txt b/source/blender/nodes/shader/CMakeLists.txt index 6e2ad57865b..a665aaee5b1 100644 --- a/source/blender/nodes/shader/CMakeLists.txt +++ b/source/blender/nodes/shader/CMakeLists.txt @@ -166,3 +166,8 @@ if(WITH_FREESTYLE) endif() blender_add_lib(bf_nodes_shader "${SRC}" "${INC}" "${INC_SYS}" "${LIB}") + +if(WITH_UNITY_BUILD) + set_target_properties(bf_nodes_shader PROPERTIES UNITY_BUILD ON) + set_target_properties(bf_nodes_shader PROPERTIES UNITY_BUILD_BATCH_SIZE 10) +endif() diff --git a/source/blender/nodes/shader/node_shader_util.cc b/source/blender/nodes/shader/node_shader_util.cc index f2464d4c1b4..ce8c8c1288a 100644 --- a/source/blender/nodes/shader/node_shader_util.cc +++ b/source/blender/nodes/shader/node_shader_util.cc @@ -49,19 +49,18 @@ static bool sh_fn_poll_default(bNodeType *UNUSED(ntype), return true; } -void sh_node_type_base( - struct bNodeType *ntype, int type, const char *name, short nclass, short flag) +void sh_node_type_base(struct bNodeType *ntype, int type, const char *name, short nclass) { - node_type_base(ntype, type, name, nclass, flag); + node_type_base(ntype, type, name, nclass); ntype->poll = sh_node_poll_default; ntype->insert_link = node_insert_link_default; ntype->gather_link_search_ops = blender::nodes::search_link_ops_for_basic_node; } -void sh_fn_node_type_base(bNodeType *ntype, int type, const char *name, short nclass, short flag) +void sh_fn_node_type_base(bNodeType *ntype, int type, const char *name, short nclass) { - sh_node_type_base(ntype, type, name, nclass, flag); + sh_node_type_base(ntype, type, name, nclass); ntype->poll = sh_fn_poll_default; ntype->gather_link_search_ops = blender::nodes::search_link_ops_for_basic_node; } diff --git a/source/blender/nodes/shader/node_shader_util.h b/source/blender/nodes/shader/node_shader_util.h index c647b86a19a..7b1c06f6a56 100644 --- a/source/blender/nodes/shader/node_shader_util.h +++ b/source/blender/nodes/shader/node_shader_util.h @@ -84,10 +84,8 @@ extern "C" { bool sh_node_poll_default(struct bNodeType *ntype, struct bNodeTree *ntree, const char **r_disabled_hint); -void sh_node_type_base( - struct bNodeType *ntype, int type, const char *name, short nclass, short flag); -void sh_fn_node_type_base( - struct bNodeType *ntype, int type, const char *name, short nclass, short flag); +void sh_node_type_base(struct bNodeType *ntype, int type, const char *name, short nclass); +void sh_fn_node_type_base(struct bNodeType *ntype, int type, const char *name, short nclass); /* ********* exec data struct, remains internal *********** */ diff --git a/source/blender/nodes/shader/nodes/node_shader_add_shader.cc b/source/blender/nodes/shader/nodes/node_shader_add_shader.cc index f1c0f5fa1c0..5e5c3e73ec0 100644 --- a/source/blender/nodes/shader/nodes/node_shader_add_shader.cc +++ b/source/blender/nodes/shader/nodes/node_shader_add_shader.cc @@ -52,7 +52,7 @@ void register_node_type_sh_add_shader() static bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_ADD_SHADER, "Add Shader", NODE_CLASS_SHADER, 0); + sh_node_type_base(&ntype, SH_NODE_ADD_SHADER, "Add Shader", NODE_CLASS_SHADER); node_type_socket_templates( &ntype, file_ns::sh_node_add_shader_in, file_ns::sh_node_add_shader_out); node_type_gpu(&ntype, file_ns::node_shader_gpu_add_shader); diff --git a/source/blender/nodes/shader/nodes/node_shader_ambient_occlusion.cc b/source/blender/nodes/shader/nodes/node_shader_ambient_occlusion.cc index b4ad3d56d25..e97e807b820 100644 --- a/source/blender/nodes/shader/nodes/node_shader_ambient_occlusion.cc +++ b/source/blender/nodes/shader/nodes/node_shader_ambient_occlusion.cc @@ -75,7 +75,7 @@ void register_node_type_sh_ambient_occlusion() static bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_AMBIENT_OCCLUSION, "Ambient Occlusion", NODE_CLASS_INPUT, 0); + sh_node_type_base(&ntype, SH_NODE_AMBIENT_OCCLUSION, "Ambient Occlusion", NODE_CLASS_INPUT); node_type_socket_templates( &ntype, file_ns::sh_node_ambient_occlusion_in, file_ns::sh_node_ambient_occlusion_out); node_type_init(&ntype, file_ns::node_shader_init_ambient_occlusion); diff --git a/source/blender/nodes/shader/nodes/node_shader_attribute.cc b/source/blender/nodes/shader/nodes/node_shader_attribute.cc index f0965e3a476..416ee844f96 100644 --- a/source/blender/nodes/shader/nodes/node_shader_attribute.cc +++ b/source/blender/nodes/shader/nodes/node_shader_attribute.cc @@ -92,7 +92,7 @@ void register_node_type_sh_attribute() static bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_ATTRIBUTE, "Attribute", NODE_CLASS_INPUT, 0); + sh_node_type_base(&ntype, SH_NODE_ATTRIBUTE, "Attribute", NODE_CLASS_INPUT); node_type_socket_templates(&ntype, nullptr, file_ns::sh_node_attribute_out); node_type_init(&ntype, file_ns::node_shader_init_attribute); node_type_storage( diff --git a/source/blender/nodes/shader/nodes/node_shader_background.cc b/source/blender/nodes/shader/nodes/node_shader_background.cc index b6ac0e06472..8d2aebed59c 100644 --- a/source/blender/nodes/shader/nodes/node_shader_background.cc +++ b/source/blender/nodes/shader/nodes/node_shader_background.cc @@ -52,7 +52,7 @@ void register_node_type_sh_background() static bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_BACKGROUND, "Background", NODE_CLASS_SHADER, 0); + sh_node_type_base(&ntype, SH_NODE_BACKGROUND, "Background", NODE_CLASS_SHADER); node_type_socket_templates( &ntype, file_ns::sh_node_background_in, file_ns::sh_node_background_out); node_type_gpu(&ntype, file_ns::node_shader_gpu_background); diff --git a/source/blender/nodes/shader/nodes/node_shader_bevel.cc b/source/blender/nodes/shader/nodes/node_shader_bevel.cc index 5c97d66c345..2ced75ef188 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bevel.cc +++ b/source/blender/nodes/shader/nodes/node_shader_bevel.cc @@ -65,7 +65,7 @@ void register_node_type_sh_bevel() static bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_BEVEL, "Bevel", NODE_CLASS_INPUT, 0); + sh_node_type_base(&ntype, SH_NODE_BEVEL, "Bevel", NODE_CLASS_INPUT); node_type_socket_templates(&ntype, file_ns::sh_node_bevel_in, file_ns::sh_node_bevel_out); node_type_init(&ntype, file_ns::node_shader_init_bevel); node_type_gpu(&ntype, file_ns::gpu_shader_bevel); diff --git a/source/blender/nodes/shader/nodes/node_shader_blackbody.cc b/source/blender/nodes/shader/nodes/node_shader_blackbody.cc index e9d25c0c32f..d78129e2b1b 100644 --- a/source/blender/nodes/shader/nodes/node_shader_blackbody.cc +++ b/source/blender/nodes/shader/nodes/node_shader_blackbody.cc @@ -58,7 +58,7 @@ void register_node_type_sh_blackbody() static bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_BLACKBODY, "Blackbody", NODE_CLASS_CONVERTER, 0); + sh_node_type_base(&ntype, SH_NODE_BLACKBODY, "Blackbody", NODE_CLASS_CONVERTER); node_type_size_preset(&ntype, NODE_SIZE_MIDDLE); node_type_socket_templates( &ntype, file_ns::sh_node_blackbody_in, file_ns::sh_node_blackbody_out); diff --git a/source/blender/nodes/shader/nodes/node_shader_brightness.cc b/source/blender/nodes/shader/nodes/node_shader_brightness.cc index 1028d9cafd9..b66a40fe869 100644 --- a/source/blender/nodes/shader/nodes/node_shader_brightness.cc +++ b/source/blender/nodes/shader/nodes/node_shader_brightness.cc @@ -52,7 +52,7 @@ void register_node_type_sh_brightcontrast() static bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_BRIGHTCONTRAST, "Bright/Contrast", NODE_CLASS_OP_COLOR, 0); + sh_node_type_base(&ntype, SH_NODE_BRIGHTCONTRAST, "Bright/Contrast", NODE_CLASS_OP_COLOR); node_type_socket_templates( &ntype, file_ns::sh_node_brightcontrast_in, file_ns::sh_node_brightcontrast_out); node_type_gpu(&ntype, file_ns::gpu_shader_brightcontrast); diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_anisotropic.cc b/source/blender/nodes/shader/nodes/node_shader_bsdf_anisotropic.cc index e07b5bd2504..c217f8eb82d 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bsdf_anisotropic.cc +++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_anisotropic.cc @@ -75,7 +75,7 @@ void register_node_type_sh_bsdf_anisotropic() static bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_BSDF_ANISOTROPIC, "Anisotropic BSDF", NODE_CLASS_SHADER, 0); + sh_node_type_base(&ntype, SH_NODE_BSDF_ANISOTROPIC, "Anisotropic BSDF", NODE_CLASS_SHADER); node_type_socket_templates( &ntype, file_ns::sh_node_bsdf_anisotropic_in, file_ns::sh_node_bsdf_anisotropic_out); node_type_size_preset(&ntype, NODE_SIZE_MIDDLE); diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_diffuse.cc b/source/blender/nodes/shader/nodes/node_shader_bsdf_diffuse.cc index 3fe90a32b22..d79f655fe1d 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bsdf_diffuse.cc +++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_diffuse.cc @@ -59,7 +59,7 @@ void register_node_type_sh_bsdf_diffuse() static bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_BSDF_DIFFUSE, "Diffuse BSDF", NODE_CLASS_SHADER, 0); + sh_node_type_base(&ntype, SH_NODE_BSDF_DIFFUSE, "Diffuse BSDF", NODE_CLASS_SHADER); node_type_socket_templates( &ntype, file_ns::sh_node_bsdf_diffuse_in, file_ns::sh_node_bsdf_diffuse_out); node_type_size_preset(&ntype, NODE_SIZE_MIDDLE); diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_glass.cc b/source/blender/nodes/shader/nodes/node_shader_bsdf_glass.cc index ccbdb5d5039..61e8b6770bb 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bsdf_glass.cc +++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_glass.cc @@ -77,7 +77,7 @@ void register_node_type_sh_bsdf_glass() static bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_BSDF_GLASS, "Glass BSDF", NODE_CLASS_SHADER, 0); + sh_node_type_base(&ntype, SH_NODE_BSDF_GLASS, "Glass BSDF", NODE_CLASS_SHADER); node_type_socket_templates( &ntype, file_ns::sh_node_bsdf_glass_in, file_ns::sh_node_bsdf_glass_out); node_type_size_preset(&ntype, NODE_SIZE_MIDDLE); diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_glossy.cc b/source/blender/nodes/shader/nodes/node_shader_bsdf_glossy.cc index afcc92c0fe0..70f6656c11f 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bsdf_glossy.cc +++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_glossy.cc @@ -76,7 +76,7 @@ void register_node_type_sh_bsdf_glossy() static bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_BSDF_GLOSSY, "Glossy BSDF", NODE_CLASS_SHADER, 0); + sh_node_type_base(&ntype, SH_NODE_BSDF_GLOSSY, "Glossy BSDF", NODE_CLASS_SHADER); node_type_socket_templates( &ntype, file_ns::sh_node_bsdf_glossy_in, file_ns::sh_node_bsdf_glossy_out); node_type_size_preset(&ntype, NODE_SIZE_MIDDLE); diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_hair.cc b/source/blender/nodes/shader/nodes/node_shader_bsdf_hair.cc index 79a8901e265..034145d31af 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bsdf_hair.cc +++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_hair.cc @@ -55,7 +55,7 @@ void register_node_type_sh_bsdf_hair() static bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_BSDF_HAIR, "Hair BSDF", NODE_CLASS_SHADER, 0); + sh_node_type_base(&ntype, SH_NODE_BSDF_HAIR, "Hair BSDF", NODE_CLASS_SHADER); node_type_socket_templates( &ntype, file_ns::sh_node_bsdf_hair_in, file_ns::sh_node_bsdf_hair_out); node_type_size(&ntype, 150, 60, 200); diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_hair_principled.cc b/source/blender/nodes/shader/nodes/node_shader_bsdf_hair_principled.cc index 8c0d3c5e1bd..5fea8148ec2 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bsdf_hair_principled.cc +++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_hair_principled.cc @@ -102,7 +102,7 @@ void register_node_type_sh_bsdf_hair_principled() static bNodeType ntype; sh_node_type_base( - &ntype, SH_NODE_BSDF_HAIR_PRINCIPLED, "Principled Hair BSDF", NODE_CLASS_SHADER, 0); + &ntype, SH_NODE_BSDF_HAIR_PRINCIPLED, "Principled Hair BSDF", NODE_CLASS_SHADER); node_type_socket_templates( &ntype, file_ns::sh_node_bsdf_hair_principled_in, file_ns::sh_node_bsdf_hair_principled_out); node_type_size_preset(&ntype, NODE_SIZE_LARGE); diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_principled.cc b/source/blender/nodes/shader/nodes/node_shader_bsdf_principled.cc index ac74e017f25..848c7035e44 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bsdf_principled.cc +++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_principled.cc @@ -194,7 +194,7 @@ void register_node_type_sh_bsdf_principled() static bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_BSDF_PRINCIPLED, "Principled BSDF", NODE_CLASS_SHADER, 0); + sh_node_type_base(&ntype, SH_NODE_BSDF_PRINCIPLED, "Principled BSDF", NODE_CLASS_SHADER); node_type_socket_templates( &ntype, file_ns::sh_node_bsdf_principled_in, file_ns::sh_node_bsdf_principled_out); node_type_size_preset(&ntype, NODE_SIZE_LARGE); diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_refraction.cc b/source/blender/nodes/shader/nodes/node_shader_bsdf_refraction.cc index 1b802cbb973..0b44f4a6735 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bsdf_refraction.cc +++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_refraction.cc @@ -69,7 +69,7 @@ void register_node_type_sh_bsdf_refraction() static bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_BSDF_REFRACTION, "Refraction BSDF", NODE_CLASS_SHADER, 0); + sh_node_type_base(&ntype, SH_NODE_BSDF_REFRACTION, "Refraction BSDF", NODE_CLASS_SHADER); node_type_socket_templates( &ntype, file_ns::sh_node_bsdf_refraction_in, file_ns::sh_node_bsdf_refraction_out); node_type_size_preset(&ntype, NODE_SIZE_MIDDLE); diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_toon.cc b/source/blender/nodes/shader/nodes/node_shader_bsdf_toon.cc index 499cf990d0c..1cb6d16b633 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bsdf_toon.cc +++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_toon.cc @@ -60,7 +60,7 @@ void register_node_type_sh_bsdf_toon() static bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_BSDF_TOON, "Toon BSDF", NODE_CLASS_SHADER, 0); + sh_node_type_base(&ntype, SH_NODE_BSDF_TOON, "Toon BSDF", NODE_CLASS_SHADER); node_type_socket_templates( &ntype, file_ns::sh_node_bsdf_toon_in, file_ns::sh_node_bsdf_toon_out); node_type_size_preset(&ntype, NODE_SIZE_MIDDLE); diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_translucent.cc b/source/blender/nodes/shader/nodes/node_shader_bsdf_translucent.cc index 00bff9cdb9f..d7d389a2bbd 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bsdf_translucent.cc +++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_translucent.cc @@ -58,7 +58,7 @@ void register_node_type_sh_bsdf_translucent() static bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_BSDF_TRANSLUCENT, "Translucent BSDF", NODE_CLASS_SHADER, 0); + sh_node_type_base(&ntype, SH_NODE_BSDF_TRANSLUCENT, "Translucent BSDF", NODE_CLASS_SHADER); node_type_socket_templates( &ntype, file_ns::sh_node_bsdf_translucent_in, file_ns::sh_node_bsdf_translucent_out); node_type_gpu(&ntype, file_ns::node_shader_gpu_bsdf_translucent); diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_transparent.cc b/source/blender/nodes/shader/nodes/node_shader_bsdf_transparent.cc index 8db43284519..e5e3744e67d 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bsdf_transparent.cc +++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_transparent.cc @@ -51,7 +51,7 @@ void register_node_type_sh_bsdf_transparent() static bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_BSDF_TRANSPARENT, "Transparent BSDF", NODE_CLASS_SHADER, 0); + sh_node_type_base(&ntype, SH_NODE_BSDF_TRANSPARENT, "Transparent BSDF", NODE_CLASS_SHADER); node_type_socket_templates( &ntype, file_ns::sh_node_bsdf_transparent_in, file_ns::sh_node_bsdf_transparent_out); node_type_gpu(&ntype, file_ns::node_shader_gpu_bsdf_transparent); diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_velvet.cc b/source/blender/nodes/shader/nodes/node_shader_bsdf_velvet.cc index b7326543dfa..683883ef272 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bsdf_velvet.cc +++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_velvet.cc @@ -59,7 +59,7 @@ void register_node_type_sh_bsdf_velvet() static bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_BSDF_VELVET, "Velvet BSDF", NODE_CLASS_SHADER, 0); + sh_node_type_base(&ntype, SH_NODE_BSDF_VELVET, "Velvet BSDF", NODE_CLASS_SHADER); node_type_socket_templates( &ntype, file_ns::sh_node_bsdf_velvet_in, file_ns::sh_node_bsdf_velvet_out); node_type_gpu(&ntype, file_ns::node_shader_gpu_bsdf_velvet); diff --git a/source/blender/nodes/shader/nodes/node_shader_bump.cc b/source/blender/nodes/shader/nodes/node_shader_bump.cc index 266524a21db..5108a8b3345 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bump.cc +++ b/source/blender/nodes/shader/nodes/node_shader_bump.cc @@ -71,7 +71,7 @@ void register_node_type_sh_bump() static bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_BUMP, "Bump", NODE_CLASS_OP_VECTOR, 0); + sh_node_type_base(&ntype, SH_NODE_BUMP, "Bump", NODE_CLASS_OP_VECTOR); ntype.declare = file_ns::node_declare; node_type_gpu(&ntype, file_ns::gpu_shader_bump); diff --git a/source/blender/nodes/shader/nodes/node_shader_camera.cc b/source/blender/nodes/shader/nodes/node_shader_camera.cc index 8154b773cfd..552eb13cb5a 100644 --- a/source/blender/nodes/shader/nodes/node_shader_camera.cc +++ b/source/blender/nodes/shader/nodes/node_shader_camera.cc @@ -54,7 +54,7 @@ void register_node_type_sh_camera() static bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_CAMERA, "Camera Data", NODE_CLASS_INPUT, 0); + sh_node_type_base(&ntype, SH_NODE_CAMERA, "Camera Data", NODE_CLASS_INPUT); node_type_socket_templates(&ntype, nullptr, file_ns::sh_node_camera_out); node_type_gpu(&ntype, file_ns::gpu_shader_camera); diff --git a/source/blender/nodes/shader/nodes/node_shader_clamp.cc b/source/blender/nodes/shader/nodes/node_shader_clamp.cc index 172bd333259..1ada2259bbc 100644 --- a/source/blender/nodes/shader/nodes/node_shader_clamp.cc +++ b/source/blender/nodes/shader/nodes/node_shader_clamp.cc @@ -81,7 +81,7 @@ void register_node_type_sh_clamp() static bNodeType ntype; - sh_fn_node_type_base(&ntype, SH_NODE_CLAMP, "Clamp", NODE_CLASS_CONVERTER, 0); + sh_fn_node_type_base(&ntype, SH_NODE_CLAMP, "Clamp", NODE_CLASS_CONVERTER); ntype.declare = file_ns::sh_node_clamp_declare; node_type_init(&ntype, file_ns::node_shader_init_clamp); node_type_gpu(&ntype, file_ns::gpu_shader_clamp); diff --git a/source/blender/nodes/shader/nodes/node_shader_color_ramp.cc b/source/blender/nodes/shader/nodes/node_shader_color_ramp.cc index 1b689563ebf..84f263ba022 100644 --- a/source/blender/nodes/shader/nodes/node_shader_color_ramp.cc +++ b/source/blender/nodes/shader/nodes/node_shader_color_ramp.cc @@ -176,7 +176,7 @@ void register_node_type_sh_valtorgb() static bNodeType ntype; - sh_fn_node_type_base(&ntype, SH_NODE_VALTORGB, "ColorRamp", NODE_CLASS_CONVERTER, 0); + sh_fn_node_type_base(&ntype, SH_NODE_VALTORGB, "ColorRamp", NODE_CLASS_CONVERTER); ntype.declare = file_ns::sh_node_valtorgb_declare; node_type_init(&ntype, file_ns::node_shader_init_valtorgb); node_type_size_preset(&ntype, NODE_SIZE_LARGE); diff --git a/source/blender/nodes/shader/nodes/node_shader_common.c b/source/blender/nodes/shader/nodes/node_shader_common.c index 190e0cfad4c..98d4822b0db 100644 --- a/source/blender/nodes/shader/nodes/node_shader_common.c +++ b/source/blender/nodes/shader/nodes/node_shader_common.c @@ -232,7 +232,7 @@ void register_node_type_sh_group(void) /* NOTE: cannot use #sh_node_type_base for node group, because it would map the node type * to the shared #NODE_GROUP integer type id. */ - node_type_base_custom(&ntype, "ShaderNodeGroup", "Group", NODE_CLASS_GROUP, 0); + node_type_base_custom(&ntype, "ShaderNodeGroup", "Group", NODE_CLASS_GROUP); ntype.type = NODE_GROUP; ntype.poll = sh_node_poll_default; ntype.poll_instance = node_group_poll_instance; diff --git a/source/blender/nodes/shader/nodes/node_shader_curves.cc b/source/blender/nodes/shader/nodes/node_shader_curves.cc index 45c1fbdfc8a..b2a8960eafc 100644 --- a/source/blender/nodes/shader/nodes/node_shader_curves.cc +++ b/source/blender/nodes/shader/nodes/node_shader_curves.cc @@ -158,7 +158,7 @@ void register_node_type_sh_curve_vec() static bNodeType ntype; - sh_fn_node_type_base(&ntype, SH_NODE_CURVE_VEC, "Vector Curves", NODE_CLASS_OP_VECTOR, 0); + sh_fn_node_type_base(&ntype, SH_NODE_CURVE_VEC, "Vector Curves", NODE_CLASS_OP_VECTOR); ntype.declare = file_ns::sh_node_curve_vec_declare; node_type_init(&ntype, file_ns::node_shader_init_curve_vec); node_type_size_preset(&ntype, NODE_SIZE_LARGE); @@ -337,7 +337,7 @@ void register_node_type_sh_curve_rgb() static bNodeType ntype; - sh_fn_node_type_base(&ntype, SH_NODE_CURVE_RGB, "RGB Curves", NODE_CLASS_OP_COLOR, 0); + sh_fn_node_type_base(&ntype, SH_NODE_CURVE_RGB, "RGB Curves", NODE_CLASS_OP_COLOR); ntype.declare = file_ns::sh_node_curve_rgb_declare; node_type_init(&ntype, file_ns::node_shader_init_curve_rgb); node_type_size_preset(&ntype, NODE_SIZE_LARGE); @@ -483,7 +483,7 @@ void register_node_type_sh_curve_float() static bNodeType ntype; - sh_fn_node_type_base(&ntype, SH_NODE_CURVE_FLOAT, "Float Curve", NODE_CLASS_CONVERTER, 0); + sh_fn_node_type_base(&ntype, SH_NODE_CURVE_FLOAT, "Float Curve", NODE_CLASS_CONVERTER); ntype.declare = file_ns::sh_node_curve_float_declare; node_type_init(&ntype, file_ns::node_shader_init_curve_float); node_type_size_preset(&ntype, NODE_SIZE_LARGE); diff --git a/source/blender/nodes/shader/nodes/node_shader_displacement.cc b/source/blender/nodes/shader/nodes/node_shader_displacement.cc index 7c3b5f9f7a9..3a3212342d2 100644 --- a/source/blender/nodes/shader/nodes/node_shader_displacement.cc +++ b/source/blender/nodes/shader/nodes/node_shader_displacement.cc @@ -79,7 +79,7 @@ void register_node_type_sh_displacement() static bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_DISPLACEMENT, "Displacement", NODE_CLASS_OP_VECTOR, 0); + sh_node_type_base(&ntype, SH_NODE_DISPLACEMENT, "Displacement", NODE_CLASS_OP_VECTOR); node_type_socket_templates( &ntype, file_ns::sh_node_displacement_in, file_ns::sh_node_displacement_out); node_type_init(&ntype, file_ns::node_shader_init_displacement); diff --git a/source/blender/nodes/shader/nodes/node_shader_eevee_specular.cc b/source/blender/nodes/shader/nodes/node_shader_eevee_specular.cc index 0b24caa0e83..41c1793deab 100644 --- a/source/blender/nodes/shader/nodes/node_shader_eevee_specular.cc +++ b/source/blender/nodes/shader/nodes/node_shader_eevee_specular.cc @@ -97,7 +97,7 @@ void register_node_type_sh_eevee_specular() static bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_EEVEE_SPECULAR, "Specular BSDF", NODE_CLASS_SHADER, 0); + sh_node_type_base(&ntype, SH_NODE_EEVEE_SPECULAR, "Specular BSDF", NODE_CLASS_SHADER); node_type_socket_templates( &ntype, file_ns::sh_node_eevee_specular_in, file_ns::sh_node_eevee_specular_out); node_type_gpu(&ntype, file_ns::node_shader_gpu_eevee_specular); diff --git a/source/blender/nodes/shader/nodes/node_shader_emission.cc b/source/blender/nodes/shader/nodes/node_shader_emission.cc index 114f83893ce..a7421477a27 100644 --- a/source/blender/nodes/shader/nodes/node_shader_emission.cc +++ b/source/blender/nodes/shader/nodes/node_shader_emission.cc @@ -52,7 +52,7 @@ void register_node_type_sh_emission() static bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_EMISSION, "Emission", NODE_CLASS_SHADER, 0); + sh_node_type_base(&ntype, SH_NODE_EMISSION, "Emission", NODE_CLASS_SHADER); node_type_socket_templates(&ntype, file_ns::sh_node_emission_in, file_ns::sh_node_emission_out); node_type_gpu(&ntype, file_ns::node_shader_gpu_emission); diff --git a/source/blender/nodes/shader/nodes/node_shader_fresnel.cc b/source/blender/nodes/shader/nodes/node_shader_fresnel.cc index a6317c1adba..2bb04f6bdef 100644 --- a/source/blender/nodes/shader/nodes/node_shader_fresnel.cc +++ b/source/blender/nodes/shader/nodes/node_shader_fresnel.cc @@ -68,10 +68,10 @@ void register_node_type_sh_fresnel() static bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_FRESNEL, "Fresnel", NODE_CLASS_INPUT, 0); + sh_node_type_base(&ntype, SH_NODE_FRESNEL, "Fresnel", NODE_CLASS_INPUT); node_type_socket_templates(&ntype, file_ns::sh_node_fresnel_in, file_ns::sh_node_fresnel_out); node_type_gpu(&ntype, file_ns::node_shader_gpu_fresnel); - node_type_exec(&ntype, NULL, NULL, file_ns::node_shader_exec_fresnel); + node_type_exec(&ntype, nullptr, nullptr, file_ns::node_shader_exec_fresnel); nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/shader/nodes/node_shader_gamma.cc b/source/blender/nodes/shader/nodes/node_shader_gamma.cc index 4e20f733192..08a2a818ead 100644 --- a/source/blender/nodes/shader/nodes/node_shader_gamma.cc +++ b/source/blender/nodes/shader/nodes/node_shader_gamma.cc @@ -68,7 +68,7 @@ void register_node_type_sh_gamma() static bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_GAMMA, "Gamma", NODE_CLASS_OP_COLOR, 0); + sh_node_type_base(&ntype, SH_NODE_GAMMA, "Gamma", NODE_CLASS_OP_COLOR); node_type_socket_templates(&ntype, file_ns::sh_node_gamma_in, file_ns::sh_node_gamma_out); node_type_exec(&ntype, nullptr, nullptr, file_ns::node_shader_exec_gamma); node_type_gpu(&ntype, file_ns::node_shader_gpu_gamma); diff --git a/source/blender/nodes/shader/nodes/node_shader_geometry.cc b/source/blender/nodes/shader/nodes/node_shader_geometry.cc index 15b3a64b3b2..012410eae0f 100644 --- a/source/blender/nodes/shader/nodes/node_shader_geometry.cc +++ b/source/blender/nodes/shader/nodes/node_shader_geometry.cc @@ -97,7 +97,7 @@ void register_node_type_sh_geometry() static bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_NEW_GEOMETRY, "Geometry", NODE_CLASS_INPUT, 0); + sh_node_type_base(&ntype, SH_NODE_NEW_GEOMETRY, "Geometry", NODE_CLASS_INPUT); node_type_socket_templates(&ntype, nullptr, file_ns::sh_node_geometry_out); node_type_gpu(&ntype, file_ns::node_shader_gpu_geometry); diff --git a/source/blender/nodes/shader/nodes/node_shader_hair_info.cc b/source/blender/nodes/shader/nodes/node_shader_hair_info.cc index 0ea1d09c683..6420144e057 100644 --- a/source/blender/nodes/shader/nodes/node_shader_hair_info.cc +++ b/source/blender/nodes/shader/nodes/node_shader_hair_info.cc @@ -54,7 +54,7 @@ void register_node_type_sh_hair_info() static bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_HAIR_INFO, "Hair Info", NODE_CLASS_INPUT, 0); + sh_node_type_base(&ntype, SH_NODE_HAIR_INFO, "Hair Info", NODE_CLASS_INPUT); node_type_socket_templates(&ntype, nullptr, file_ns::outputs); node_type_gpu(&ntype, file_ns::node_shader_gpu_hair_info); diff --git a/source/blender/nodes/shader/nodes/node_shader_holdout.cc b/source/blender/nodes/shader/nodes/node_shader_holdout.cc index 048a6e8749a..a0c84233dbb 100644 --- a/source/blender/nodes/shader/nodes/node_shader_holdout.cc +++ b/source/blender/nodes/shader/nodes/node_shader_holdout.cc @@ -50,7 +50,7 @@ void register_node_type_sh_holdout() static bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_HOLDOUT, "Holdout", NODE_CLASS_SHADER, 0); + sh_node_type_base(&ntype, SH_NODE_HOLDOUT, "Holdout", NODE_CLASS_SHADER); node_type_socket_templates(&ntype, file_ns::sh_node_holdout_in, file_ns::sh_node_holdout_out); node_type_gpu(&ntype, file_ns::gpu_shader_rgb); diff --git a/source/blender/nodes/shader/nodes/node_shader_hueSatVal.cc b/source/blender/nodes/shader/nodes/node_shader_hueSatVal.cc index 26a7511b29b..8fe0bf28b8d 100644 --- a/source/blender/nodes/shader/nodes/node_shader_hueSatVal.cc +++ b/source/blender/nodes/shader/nodes/node_shader_hueSatVal.cc @@ -95,7 +95,7 @@ void register_node_type_sh_hue_sat() static bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_HUE_SAT, "Hue Saturation Value", NODE_CLASS_OP_COLOR, 0); + sh_node_type_base(&ntype, SH_NODE_HUE_SAT, "Hue Saturation Value", NODE_CLASS_OP_COLOR); node_type_socket_templates(&ntype, file_ns::sh_node_hue_sat_in, file_ns::sh_node_hue_sat_out); node_type_size_preset(&ntype, NODE_SIZE_MIDDLE); node_type_exec(&ntype, nullptr, nullptr, file_ns::node_shader_exec_hue_sat); diff --git a/source/blender/nodes/shader/nodes/node_shader_ies_light.cc b/source/blender/nodes/shader/nodes/node_shader_ies_light.cc index a8887e642b9..d59c37a8482 100644 --- a/source/blender/nodes/shader/nodes/node_shader_ies_light.cc +++ b/source/blender/nodes/shader/nodes/node_shader_ies_light.cc @@ -49,7 +49,7 @@ void register_node_type_sh_tex_ies() static bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_TEX_IES, "IES Texture", NODE_CLASS_TEXTURE, 0); + sh_node_type_base(&ntype, SH_NODE_TEX_IES, "IES Texture", NODE_CLASS_TEXTURE); node_type_socket_templates(&ntype, file_ns::sh_node_tex_ies_in, file_ns::sh_node_tex_ies_out); node_type_init(&ntype, file_ns::node_shader_init_tex_ies); node_type_storage( diff --git a/source/blender/nodes/shader/nodes/node_shader_invert.cc b/source/blender/nodes/shader/nodes/node_shader_invert.cc index 34862ad2246..cc2d4981310 100644 --- a/source/blender/nodes/shader/nodes/node_shader_invert.cc +++ b/source/blender/nodes/shader/nodes/node_shader_invert.cc @@ -75,7 +75,7 @@ void register_node_type_sh_invert() static bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_INVERT, "Invert", NODE_CLASS_OP_COLOR, 0); + sh_node_type_base(&ntype, SH_NODE_INVERT, "Invert", NODE_CLASS_OP_COLOR); node_type_socket_templates(&ntype, file_ns::sh_node_invert_in, file_ns::sh_node_invert_out); node_type_exec(&ntype, nullptr, nullptr, file_ns::node_shader_exec_invert); node_type_gpu(&ntype, file_ns::gpu_shader_invert); diff --git a/source/blender/nodes/shader/nodes/node_shader_layer_weight.cc b/source/blender/nodes/shader/nodes/node_shader_layer_weight.cc index 5e684cb08ac..a41e96f9f8b 100644 --- a/source/blender/nodes/shader/nodes/node_shader_layer_weight.cc +++ b/source/blender/nodes/shader/nodes/node_shader_layer_weight.cc @@ -70,7 +70,7 @@ void register_node_type_sh_layer_weight() static bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_LAYER_WEIGHT, "Layer Weight", NODE_CLASS_INPUT, 0); + sh_node_type_base(&ntype, SH_NODE_LAYER_WEIGHT, "Layer Weight", NODE_CLASS_INPUT); node_type_socket_templates( &ntype, file_ns::sh_node_layer_weight_in, file_ns::sh_node_layer_weight_out); node_type_gpu(&ntype, file_ns::node_shader_gpu_layer_weight); diff --git a/source/blender/nodes/shader/nodes/node_shader_light_falloff.cc b/source/blender/nodes/shader/nodes/node_shader_light_falloff.cc index 9d4334662c9..4840f58db74 100644 --- a/source/blender/nodes/shader/nodes/node_shader_light_falloff.cc +++ b/source/blender/nodes/shader/nodes/node_shader_light_falloff.cc @@ -56,7 +56,7 @@ void register_node_type_sh_light_falloff() static bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_LIGHT_FALLOFF, "Light Falloff", NODE_CLASS_OP_COLOR, 0); + sh_node_type_base(&ntype, SH_NODE_LIGHT_FALLOFF, "Light Falloff", NODE_CLASS_OP_COLOR); node_type_socket_templates( &ntype, file_ns::sh_node_light_falloff_in, file_ns::sh_node_light_falloff_out); node_type_size_preset(&ntype, NODE_SIZE_MIDDLE); diff --git a/source/blender/nodes/shader/nodes/node_shader_light_path.cc b/source/blender/nodes/shader/nodes/node_shader_light_path.cc index 2643dbc9e0e..40dcb64b3c2 100644 --- a/source/blender/nodes/shader/nodes/node_shader_light_path.cc +++ b/source/blender/nodes/shader/nodes/node_shader_light_path.cc @@ -58,7 +58,7 @@ void register_node_type_sh_light_path() static bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_LIGHT_PATH, "Light Path", NODE_CLASS_INPUT, 0); + sh_node_type_base(&ntype, SH_NODE_LIGHT_PATH, "Light Path", NODE_CLASS_INPUT); node_type_socket_templates(&ntype, nullptr, file_ns::sh_node_light_path_out); node_type_gpu(&ntype, file_ns::node_shader_gpu_light_path); diff --git a/source/blender/nodes/shader/nodes/node_shader_map_range.cc b/source/blender/nodes/shader/nodes/node_shader_map_range.cc index cfad7b6b887..6373462a288 100644 --- a/source/blender/nodes/shader/nodes/node_shader_map_range.cc +++ b/source/blender/nodes/shader/nodes/node_shader_map_range.cc @@ -29,10 +29,10 @@ #include "NOD_socket_search_link.hh" -NODE_STORAGE_FUNCS(NodeMapRange) - namespace blender::nodes::node_shader_map_range_cc { +NODE_STORAGE_FUNCS(NodeMapRange) + static void sh_node_map_range_declare(NodeDeclarationBuilder &b) { b.is_function_node(); @@ -648,7 +648,7 @@ void register_node_type_sh_map_range() static bNodeType ntype; - sh_fn_node_type_base(&ntype, SH_NODE_MAP_RANGE, "Map Range", NODE_CLASS_CONVERTER, 0); + sh_fn_node_type_base(&ntype, SH_NODE_MAP_RANGE, "Map Range", NODE_CLASS_CONVERTER); ntype.declare = file_ns::sh_node_map_range_declare; node_type_init(&ntype, file_ns::node_shader_init_map_range); node_type_storage( diff --git a/source/blender/nodes/shader/nodes/node_shader_mapping.cc b/source/blender/nodes/shader/nodes/node_shader_mapping.cc index d5cf2bb69ee..19eeb1dfe35 100644 --- a/source/blender/nodes/shader/nodes/node_shader_mapping.cc +++ b/source/blender/nodes/shader/nodes/node_shader_mapping.cc @@ -82,7 +82,7 @@ void register_node_type_sh_mapping() static bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_MAPPING, "Mapping", NODE_CLASS_OP_VECTOR, 0); + sh_node_type_base(&ntype, SH_NODE_MAPPING, "Mapping", NODE_CLASS_OP_VECTOR); node_type_socket_templates(&ntype, file_ns::sh_node_mapping_in, file_ns::sh_node_mapping_out); node_type_gpu(&ntype, file_ns::gpu_shader_mapping); node_type_update(&ntype, file_ns::node_shader_update_mapping); diff --git a/source/blender/nodes/shader/nodes/node_shader_math.cc b/source/blender/nodes/shader/nodes/node_shader_math.cc index 5cbecfcccc1..3fc88fb141c 100644 --- a/source/blender/nodes/shader/nodes/node_shader_math.cc +++ b/source/blender/nodes/shader/nodes/node_shader_math.cc @@ -214,7 +214,7 @@ void register_node_type_sh_math() static bNodeType ntype; - sh_fn_node_type_base(&ntype, SH_NODE_MATH, "Math", NODE_CLASS_CONVERTER, 0); + sh_fn_node_type_base(&ntype, SH_NODE_MATH, "Math", NODE_CLASS_CONVERTER); ntype.declare = file_ns::sh_node_math_declare; ntype.labelfunc = node_math_label; node_type_gpu(&ntype, file_ns::gpu_shader_math); diff --git a/source/blender/nodes/shader/nodes/node_shader_mix_rgb.cc b/source/blender/nodes/shader/nodes/node_shader_mix_rgb.cc index abcd5e6412b..970a1c0075c 100644 --- a/source/blender/nodes/shader/nodes/node_shader_mix_rgb.cc +++ b/source/blender/nodes/shader/nodes/node_shader_mix_rgb.cc @@ -189,7 +189,7 @@ void register_node_type_sh_mix_rgb() static bNodeType ntype; - sh_fn_node_type_base(&ntype, SH_NODE_MIX_RGB, "Mix", NODE_CLASS_OP_COLOR, 0); + sh_fn_node_type_base(&ntype, SH_NODE_MIX_RGB, "Mix", NODE_CLASS_OP_COLOR); ntype.declare = file_ns::sh_node_mix_rgb_declare; ntype.labelfunc = node_blend_label; node_type_exec(&ntype, nullptr, nullptr, file_ns::node_shader_exec_mix_rgb); diff --git a/source/blender/nodes/shader/nodes/node_shader_mix_shader.cc b/source/blender/nodes/shader/nodes/node_shader_mix_shader.cc index 9e28d47455c..cf644a22752 100644 --- a/source/blender/nodes/shader/nodes/node_shader_mix_shader.cc +++ b/source/blender/nodes/shader/nodes/node_shader_mix_shader.cc @@ -53,7 +53,7 @@ void register_node_type_sh_mix_shader() static bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_MIX_SHADER, "Mix Shader", NODE_CLASS_SHADER, 0); + sh_node_type_base(&ntype, SH_NODE_MIX_SHADER, "Mix Shader", NODE_CLASS_SHADER); node_type_socket_templates( &ntype, file_ns::sh_node_mix_shader_in, file_ns::sh_node_mix_shader_out); node_type_gpu(&ntype, file_ns::node_shader_gpu_mix_shader); diff --git a/source/blender/nodes/shader/nodes/node_shader_normal.cc b/source/blender/nodes/shader/nodes/node_shader_normal.cc index d448ca79501..e8a97b904d3 100644 --- a/source/blender/nodes/shader/nodes/node_shader_normal.cc +++ b/source/blender/nodes/shader/nodes/node_shader_normal.cc @@ -74,7 +74,7 @@ void register_node_type_sh_normal() static bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_NORMAL, "Normal", NODE_CLASS_OP_VECTOR, 0); + sh_node_type_base(&ntype, SH_NODE_NORMAL, "Normal", NODE_CLASS_OP_VECTOR); node_type_socket_templates(&ntype, file_ns::sh_node_normal_in, file_ns::sh_node_normal_out); node_type_exec(&ntype, nullptr, nullptr, file_ns::node_shader_exec_normal); node_type_gpu(&ntype, file_ns::gpu_shader_normal); diff --git a/source/blender/nodes/shader/nodes/node_shader_normal_map.cc b/source/blender/nodes/shader/nodes/node_shader_normal_map.cc index 0899d08f4e1..02857c3544a 100644 --- a/source/blender/nodes/shader/nodes/node_shader_normal_map.cc +++ b/source/blender/nodes/shader/nodes/node_shader_normal_map.cc @@ -126,7 +126,7 @@ void register_node_type_sh_normal_map() static bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_NORMAL_MAP, "Normal Map", NODE_CLASS_OP_VECTOR, 0); + sh_node_type_base(&ntype, SH_NODE_NORMAL_MAP, "Normal Map", NODE_CLASS_OP_VECTOR); node_type_socket_templates( &ntype, file_ns::sh_node_normal_map_in, file_ns::sh_node_normal_map_out); node_type_size_preset(&ntype, NODE_SIZE_MIDDLE); diff --git a/source/blender/nodes/shader/nodes/node_shader_object_info.cc b/source/blender/nodes/shader/nodes/node_shader_object_info.cc index a95a955789c..c3e6f2fe50a 100644 --- a/source/blender/nodes/shader/nodes/node_shader_object_info.cc +++ b/source/blender/nodes/shader/nodes/node_shader_object_info.cc @@ -59,7 +59,7 @@ void register_node_type_sh_object_info() static bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_OBJECT_INFO, "Object Info", NODE_CLASS_INPUT, 0); + sh_node_type_base(&ntype, SH_NODE_OBJECT_INFO, "Object Info", NODE_CLASS_INPUT); node_type_socket_templates(&ntype, nullptr, file_ns::sh_node_object_info_out); node_type_gpu(&ntype, file_ns::node_shader_gpu_object_info); diff --git a/source/blender/nodes/shader/nodes/node_shader_output_aov.cc b/source/blender/nodes/shader/nodes/node_shader_output_aov.cc index 3b551401b49..bc66659bca2 100644 --- a/source/blender/nodes/shader/nodes/node_shader_output_aov.cc +++ b/source/blender/nodes/shader/nodes/node_shader_output_aov.cc @@ -63,7 +63,7 @@ void register_node_type_sh_output_aov() static bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_OUTPUT_AOV, "AOV Output", NODE_CLASS_OUTPUT, 0); + sh_node_type_base(&ntype, SH_NODE_OUTPUT_AOV, "AOV Output", NODE_CLASS_OUTPUT); node_type_socket_templates(&ntype, file_ns::sh_node_output_aov_in, nullptr); node_type_init(&ntype, file_ns::node_shader_init_output_aov); node_type_storage( diff --git a/source/blender/nodes/shader/nodes/node_shader_output_light.cc b/source/blender/nodes/shader/nodes/node_shader_output_light.cc index 07ed21a8404..b6b5bb5142b 100644 --- a/source/blender/nodes/shader/nodes/node_shader_output_light.cc +++ b/source/blender/nodes/shader/nodes/node_shader_output_light.cc @@ -37,7 +37,7 @@ void register_node_type_sh_output_light() static bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_OUTPUT_LIGHT, "Light Output", NODE_CLASS_OUTPUT, 0); + sh_node_type_base(&ntype, SH_NODE_OUTPUT_LIGHT, "Light Output", NODE_CLASS_OUTPUT); node_type_socket_templates(&ntype, file_ns::sh_node_output_light_in, nullptr); ntype.no_muting = true; diff --git a/source/blender/nodes/shader/nodes/node_shader_output_linestyle.cc b/source/blender/nodes/shader/nodes/node_shader_output_linestyle.cc index 2051bb6ded0..181c38bea8b 100644 --- a/source/blender/nodes/shader/nodes/node_shader_output_linestyle.cc +++ b/source/blender/nodes/shader/nodes/node_shader_output_linestyle.cc @@ -40,7 +40,7 @@ void register_node_type_sh_output_linestyle() static bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_OUTPUT_LINESTYLE, "Line Style Output", NODE_CLASS_OUTPUT, 0); + sh_node_type_base(&ntype, SH_NODE_OUTPUT_LINESTYLE, "Line Style Output", NODE_CLASS_OUTPUT); node_type_socket_templates(&ntype, file_ns::sh_node_output_linestyle_in, nullptr); ntype.no_muting = true; diff --git a/source/blender/nodes/shader/nodes/node_shader_output_material.cc b/source/blender/nodes/shader/nodes/node_shader_output_material.cc index 308435576c1..f326e33ced5 100644 --- a/source/blender/nodes/shader/nodes/node_shader_output_material.cc +++ b/source/blender/nodes/shader/nodes/node_shader_output_material.cc @@ -84,7 +84,7 @@ void register_node_type_sh_output_material() static bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_OUTPUT_MATERIAL, "Material Output", NODE_CLASS_OUTPUT, 0); + sh_node_type_base(&ntype, SH_NODE_OUTPUT_MATERIAL, "Material Output", NODE_CLASS_OUTPUT); node_type_socket_templates(&ntype, file_ns::sh_node_output_material_in, nullptr); node_type_gpu(&ntype, file_ns::node_shader_gpu_output_material); diff --git a/source/blender/nodes/shader/nodes/node_shader_output_world.cc b/source/blender/nodes/shader/nodes/node_shader_output_world.cc index add277c2650..7b249c4afa4 100644 --- a/source/blender/nodes/shader/nodes/node_shader_output_world.cc +++ b/source/blender/nodes/shader/nodes/node_shader_output_world.cc @@ -52,7 +52,7 @@ void register_node_type_sh_output_world() static bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_OUTPUT_WORLD, "World Output", NODE_CLASS_OUTPUT, 0); + sh_node_type_base(&ntype, SH_NODE_OUTPUT_WORLD, "World Output", NODE_CLASS_OUTPUT); node_type_socket_templates(&ntype, file_ns::sh_node_output_world_in, nullptr); node_type_gpu(&ntype, file_ns::node_shader_gpu_output_world); diff --git a/source/blender/nodes/shader/nodes/node_shader_particle_info.cc b/source/blender/nodes/shader/nodes/node_shader_particle_info.cc index 8a054b19c71..b9be75046ca 100644 --- a/source/blender/nodes/shader/nodes/node_shader_particle_info.cc +++ b/source/blender/nodes/shader/nodes/node_shader_particle_info.cc @@ -73,7 +73,7 @@ void register_node_type_sh_particle_info() static bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_PARTICLE_INFO, "Particle Info", NODE_CLASS_INPUT, 0); + sh_node_type_base(&ntype, SH_NODE_PARTICLE_INFO, "Particle Info", NODE_CLASS_INPUT); node_type_socket_templates(&ntype, nullptr, file_ns::outputs); node_type_exec(&ntype, nullptr, nullptr, file_ns::node_shader_exec_particle_info); node_type_gpu(&ntype, file_ns::gpu_shader_particle_info); diff --git a/source/blender/nodes/shader/nodes/node_shader_rgb.cc b/source/blender/nodes/shader/nodes/node_shader_rgb.cc index e07b8dd4f1d..18a1d2a78dc 100644 --- a/source/blender/nodes/shader/nodes/node_shader_rgb.cc +++ b/source/blender/nodes/shader/nodes/node_shader_rgb.cc @@ -49,7 +49,7 @@ void register_node_type_sh_rgb() static bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_RGB, "RGB", NODE_CLASS_INPUT, 0); + sh_node_type_base(&ntype, SH_NODE_RGB, "RGB", NODE_CLASS_INPUT); node_type_socket_templates(&ntype, nullptr, file_ns::sh_node_rgb_out); node_type_gpu(&ntype, file_ns::gpu_shader_rgb); diff --git a/source/blender/nodes/shader/nodes/node_shader_rgb_to_bw.cc b/source/blender/nodes/shader/nodes/node_shader_rgb_to_bw.cc index 5b6eab9ed22..33440f94204 100644 --- a/source/blender/nodes/shader/nodes/node_shader_rgb_to_bw.cc +++ b/source/blender/nodes/shader/nodes/node_shader_rgb_to_bw.cc @@ -65,7 +65,7 @@ void register_node_type_sh_rgbtobw() static bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_RGBTOBW, "RGB to BW", NODE_CLASS_CONVERTER, 0); + sh_node_type_base(&ntype, SH_NODE_RGBTOBW, "RGB to BW", NODE_CLASS_CONVERTER); ntype.declare = file_ns::sh_node_rgbtobw_declare; node_type_exec(&ntype, nullptr, nullptr, file_ns::node_shader_exec_rgbtobw); node_type_gpu(&ntype, file_ns::gpu_shader_rgbtobw); diff --git a/source/blender/nodes/shader/nodes/node_shader_script.cc b/source/blender/nodes/shader/nodes/node_shader_script.cc index 52e855b5fe5..b7f811bee86 100644 --- a/source/blender/nodes/shader/nodes/node_shader_script.cc +++ b/source/blender/nodes/shader/nodes/node_shader_script.cc @@ -68,7 +68,7 @@ void register_node_type_sh_script() static bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_SCRIPT, "Script", NODE_CLASS_SCRIPT, 0); + sh_node_type_base(&ntype, SH_NODE_SCRIPT, "Script", NODE_CLASS_SCRIPT); node_type_init(&ntype, file_ns::init); node_type_storage( &ntype, "NodeShaderScript", file_ns::node_free_script, file_ns::node_copy_script); diff --git a/source/blender/nodes/shader/nodes/node_shader_sepcomb_hsv.cc b/source/blender/nodes/shader/nodes/node_shader_sepcomb_hsv.cc index 485c2ede9fe..ed88859f28b 100644 --- a/source/blender/nodes/shader/nodes/node_shader_sepcomb_hsv.cc +++ b/source/blender/nodes/shader/nodes/node_shader_sepcomb_hsv.cc @@ -67,7 +67,7 @@ void register_node_type_sh_sephsv() static bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_SEPHSV, "Separate HSV", NODE_CLASS_CONVERTER, 0); + sh_node_type_base(&ntype, SH_NODE_SEPHSV, "Separate HSV", NODE_CLASS_CONVERTER); node_type_socket_templates(&ntype, file_ns::sh_node_sephsv_in, file_ns::sh_node_sephsv_out); node_type_exec(&ntype, nullptr, nullptr, file_ns::node_shader_exec_sephsv); node_type_gpu(&ntype, file_ns::gpu_shader_sephsv); @@ -121,7 +121,7 @@ void register_node_type_sh_combhsv() static bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_COMBHSV, "Combine HSV", NODE_CLASS_CONVERTER, 0); + sh_node_type_base(&ntype, SH_NODE_COMBHSV, "Combine HSV", NODE_CLASS_CONVERTER); node_type_socket_templates(&ntype, file_ns::sh_node_combhsv_in, file_ns::sh_node_combhsv_out); node_type_exec(&ntype, nullptr, nullptr, file_ns::node_shader_exec_combhsv); node_type_gpu(&ntype, file_ns::gpu_shader_combhsv); diff --git a/source/blender/nodes/shader/nodes/node_shader_sepcomb_rgb.cc b/source/blender/nodes/shader/nodes/node_shader_sepcomb_rgb.cc index 4ecc4d163f2..5b9aeab547b 100644 --- a/source/blender/nodes/shader/nodes/node_shader_sepcomb_rgb.cc +++ b/source/blender/nodes/shader/nodes/node_shader_sepcomb_rgb.cc @@ -109,7 +109,7 @@ void register_node_type_sh_seprgb() static bNodeType ntype; - sh_fn_node_type_base(&ntype, SH_NODE_SEPRGB, "Separate RGB", NODE_CLASS_CONVERTER, 0); + sh_fn_node_type_base(&ntype, SH_NODE_SEPRGB, "Separate RGB", NODE_CLASS_CONVERTER); ntype.declare = file_ns::sh_node_seprgb_declare; node_type_exec(&ntype, nullptr, nullptr, file_ns::node_shader_exec_seprgb); node_type_gpu(&ntype, file_ns::gpu_shader_seprgb); @@ -171,7 +171,7 @@ void register_node_type_sh_combrgb() static bNodeType ntype; - sh_fn_node_type_base(&ntype, SH_NODE_COMBRGB, "Combine RGB", NODE_CLASS_CONVERTER, 0); + sh_fn_node_type_base(&ntype, SH_NODE_COMBRGB, "Combine RGB", NODE_CLASS_CONVERTER); ntype.declare = file_ns::sh_node_combrgb_declare; node_type_exec(&ntype, nullptr, nullptr, file_ns::node_shader_exec_combrgb); node_type_gpu(&ntype, file_ns::gpu_shader_combrgb); diff --git a/source/blender/nodes/shader/nodes/node_shader_sepcomb_xyz.cc b/source/blender/nodes/shader/nodes/node_shader_sepcomb_xyz.cc index 1010b46eb3b..6b4195a662a 100644 --- a/source/blender/nodes/shader/nodes/node_shader_sepcomb_xyz.cc +++ b/source/blender/nodes/shader/nodes/node_shader_sepcomb_xyz.cc @@ -94,7 +94,7 @@ void register_node_type_sh_sepxyz() static bNodeType ntype; - sh_fn_node_type_base(&ntype, SH_NODE_SEPXYZ, "Separate XYZ", NODE_CLASS_CONVERTER, 0); + sh_fn_node_type_base(&ntype, SH_NODE_SEPXYZ, "Separate XYZ", NODE_CLASS_CONVERTER); ntype.declare = file_ns::sh_node_sepxyz_declare; node_type_gpu(&ntype, file_ns::gpu_shader_sepxyz); ntype.build_multi_function = file_ns::sh_node_sepxyz_build_multi_function; @@ -137,7 +137,7 @@ void register_node_type_sh_combxyz() static bNodeType ntype; - sh_fn_node_type_base(&ntype, SH_NODE_COMBXYZ, "Combine XYZ", NODE_CLASS_CONVERTER, 0); + sh_fn_node_type_base(&ntype, SH_NODE_COMBXYZ, "Combine XYZ", NODE_CLASS_CONVERTER); ntype.declare = file_ns::sh_node_combxyz_declare; node_type_gpu(&ntype, file_ns::gpu_shader_combxyz); ntype.build_multi_function = file_ns::sh_node_combxyz_build_multi_function; diff --git a/source/blender/nodes/shader/nodes/node_shader_shader_to_rgb.cc b/source/blender/nodes/shader/nodes/node_shader_shader_to_rgb.cc index cf261e52886..d014767a944 100644 --- a/source/blender/nodes/shader/nodes/node_shader_shader_to_rgb.cc +++ b/source/blender/nodes/shader/nodes/node_shader_shader_to_rgb.cc @@ -56,7 +56,7 @@ void register_node_type_sh_shadertorgb() static bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_SHADERTORGB, "Shader to RGB", NODE_CLASS_CONVERTER, 0); + sh_node_type_base(&ntype, SH_NODE_SHADERTORGB, "Shader to RGB", NODE_CLASS_CONVERTER); node_type_socket_templates( &ntype, file_ns::sh_node_shadertorgb_in, file_ns::sh_node_shadertorgb_out); node_type_gpu(&ntype, file_ns::node_shader_gpu_shadertorgb); diff --git a/source/blender/nodes/shader/nodes/node_shader_squeeze.cc b/source/blender/nodes/shader/nodes/node_shader_squeeze.cc index 9b32a675404..f5b81871fd4 100644 --- a/source/blender/nodes/shader/nodes/node_shader_squeeze.cc +++ b/source/blender/nodes/shader/nodes/node_shader_squeeze.cc @@ -67,7 +67,7 @@ void register_node_type_sh_squeeze() static bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_SQUEEZE, "Squeeze Value", NODE_CLASS_CONVERTER, 0); + sh_node_type_base(&ntype, SH_NODE_SQUEEZE, "Squeeze Value", NODE_CLASS_CONVERTER); node_type_socket_templates(&ntype, file_ns::sh_node_squeeze_in, file_ns::sh_node_squeeze_out); node_type_exec(&ntype, nullptr, nullptr, file_ns::node_shader_exec_squeeze); node_type_gpu(&ntype, file_ns::gpu_shader_squeeze); diff --git a/source/blender/nodes/shader/nodes/node_shader_subsurface_scattering.cc b/source/blender/nodes/shader/nodes/node_shader_subsurface_scattering.cc index c6960076fc5..9cdcb2b018d 100644 --- a/source/blender/nodes/shader/nodes/node_shader_subsurface_scattering.cc +++ b/source/blender/nodes/shader/nodes/node_shader_subsurface_scattering.cc @@ -90,7 +90,7 @@ void register_node_type_sh_subsurface_scattering() static bNodeType ntype; sh_node_type_base( - &ntype, SH_NODE_SUBSURFACE_SCATTERING, "Subsurface Scattering", NODE_CLASS_SHADER, 0); + &ntype, SH_NODE_SUBSURFACE_SCATTERING, "Subsurface Scattering", NODE_CLASS_SHADER); node_type_socket_templates(&ntype, file_ns::sh_node_subsurface_scattering_in, file_ns::sh_node_subsurface_scattering_out); diff --git a/source/blender/nodes/shader/nodes/node_shader_tangent.cc b/source/blender/nodes/shader/nodes/node_shader_tangent.cc index edd361969fd..e15ceca4159 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tangent.cc +++ b/source/blender/nodes/shader/nodes/node_shader_tangent.cc @@ -79,7 +79,7 @@ void register_node_type_sh_tangent() static bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_TANGENT, "Tangent", NODE_CLASS_INPUT, 0); + sh_node_type_base(&ntype, SH_NODE_TANGENT, "Tangent", NODE_CLASS_INPUT); node_type_socket_templates(&ntype, nullptr, file_ns::sh_node_tangent_out); node_type_size_preset(&ntype, NODE_SIZE_MIDDLE); node_type_init(&ntype, file_ns::node_shader_init_tangent); diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_brick.cc b/source/blender/nodes/shader/nodes/node_shader_tex_brick.cc index b98ea9ce6fc..89c6b6dfa00 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_brick.cc +++ b/source/blender/nodes/shader/nodes/node_shader_tex_brick.cc @@ -270,7 +270,7 @@ void register_node_type_sh_tex_brick() static bNodeType ntype; - sh_fn_node_type_base(&ntype, SH_NODE_TEX_BRICK, "Brick Texture", NODE_CLASS_TEXTURE, 0); + sh_fn_node_type_base(&ntype, SH_NODE_TEX_BRICK, "Brick Texture", NODE_CLASS_TEXTURE); ntype.declare = file_ns::sh_node_tex_brick_declare; node_type_size_preset(&ntype, NODE_SIZE_MIDDLE); node_type_init(&ntype, file_ns::node_shader_init_tex_brick); diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_checker.cc b/source/blender/nodes/shader/nodes/node_shader_tex_checker.cc index 7c1e1a5bb26..c9c4355129b 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_checker.cc +++ b/source/blender/nodes/shader/nodes/node_shader_tex_checker.cc @@ -125,7 +125,7 @@ void register_node_type_sh_tex_checker() static bNodeType ntype; - sh_fn_node_type_base(&ntype, SH_NODE_TEX_CHECKER, "Checker Texture", NODE_CLASS_TEXTURE, 0); + sh_fn_node_type_base(&ntype, SH_NODE_TEX_CHECKER, "Checker Texture", NODE_CLASS_TEXTURE); ntype.declare = file_ns::sh_node_tex_checker_declare; node_type_init(&ntype, file_ns::node_shader_init_tex_checker); node_type_storage( diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_coord.cc b/source/blender/nodes/shader/nodes/node_shader_tex_coord.cc index a7768871cf8..57296807caa 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_coord.cc +++ b/source/blender/nodes/shader/nodes/node_shader_tex_coord.cc @@ -94,7 +94,7 @@ void register_node_type_sh_tex_coord() static bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_TEX_COORD, "Texture Coordinate", NODE_CLASS_INPUT, 0); + sh_node_type_base(&ntype, SH_NODE_TEX_COORD, "Texture Coordinate", NODE_CLASS_INPUT); node_type_socket_templates(&ntype, nullptr, file_ns::sh_node_tex_coord_out); node_type_gpu(&ntype, file_ns::node_shader_gpu_tex_coord); diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_environment.cc b/source/blender/nodes/shader/nodes/node_shader_tex_environment.cc index 00bafd1a9d3..d01b2acca45 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_environment.cc +++ b/source/blender/nodes/shader/nodes/node_shader_tex_environment.cc @@ -143,7 +143,7 @@ void register_node_type_sh_tex_environment() static bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_TEX_ENVIRONMENT, "Environment Texture", NODE_CLASS_TEXTURE, 0); + sh_node_type_base(&ntype, SH_NODE_TEX_ENVIRONMENT, "Environment Texture", NODE_CLASS_TEXTURE); node_type_socket_templates( &ntype, file_ns::sh_node_tex_environment_in, file_ns::sh_node_tex_environment_out); node_type_init(&ntype, file_ns::node_shader_init_tex_environment); diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_gradient.cc b/source/blender/nodes/shader/nodes/node_shader_tex_gradient.cc index 3c8f0494b25..b92e78e6fb8 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_gradient.cc +++ b/source/blender/nodes/shader/nodes/node_shader_tex_gradient.cc @@ -161,7 +161,7 @@ void register_node_type_sh_tex_gradient() static bNodeType ntype; - sh_fn_node_type_base(&ntype, SH_NODE_TEX_GRADIENT, "Gradient Texture", NODE_CLASS_TEXTURE, 0); + sh_fn_node_type_base(&ntype, SH_NODE_TEX_GRADIENT, "Gradient Texture", NODE_CLASS_TEXTURE); ntype.declare = file_ns::sh_node_tex_gradient_declare; node_type_init(&ntype, file_ns::node_shader_init_tex_gradient); node_type_storage( diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_image.cc b/source/blender/nodes/shader/nodes/node_shader_tex_image.cc index 96b36ab201b..0ec8d648f3c 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_image.cc +++ b/source/blender/nodes/shader/nodes/node_shader_tex_image.cc @@ -179,7 +179,7 @@ void register_node_type_sh_tex_image() static bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_TEX_IMAGE, "Image Texture", NODE_CLASS_TEXTURE, 0); + sh_node_type_base(&ntype, SH_NODE_TEX_IMAGE, "Image Texture", NODE_CLASS_TEXTURE); ntype.declare = file_ns::sh_node_tex_image_declare; node_type_init(&ntype, file_ns::node_shader_init_tex_image); node_type_storage( diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_magic.cc b/source/blender/nodes/shader/nodes/node_shader_tex_magic.cc index 0b745277d80..ea628e3e83c 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_magic.cc +++ b/source/blender/nodes/shader/nodes/node_shader_tex_magic.cc @@ -183,7 +183,7 @@ void register_node_type_sh_tex_magic() static bNodeType ntype; - sh_fn_node_type_base(&ntype, SH_NODE_TEX_MAGIC, "Magic Texture", NODE_CLASS_TEXTURE, 0); + sh_fn_node_type_base(&ntype, SH_NODE_TEX_MAGIC, "Magic Texture", NODE_CLASS_TEXTURE); ntype.declare = file_ns::sh_node_tex_magic_declare; node_type_init(&ntype, file_ns::node_shader_init_tex_magic); node_type_storage( diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_musgrave.cc b/source/blender/nodes/shader/nodes/node_shader_tex_musgrave.cc index 2e0dd28ac8c..8f0f251e97a 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_musgrave.cc +++ b/source/blender/nodes/shader/nodes/node_shader_tex_musgrave.cc @@ -21,10 +21,10 @@ #include "BLI_noise.hh" -NODE_STORAGE_FUNCS(NodeTexMusgrave) - namespace blender::nodes::node_shader_tex_musgrave_cc { +NODE_STORAGE_FUNCS(NodeTexMusgrave) + static void sh_node_tex_musgrave_declare(NodeDeclarationBuilder &b) { b.is_function_node(); @@ -537,7 +537,7 @@ void register_node_type_sh_tex_musgrave() static bNodeType ntype; - sh_fn_node_type_base(&ntype, SH_NODE_TEX_MUSGRAVE, "Musgrave Texture", NODE_CLASS_TEXTURE, 0); + sh_fn_node_type_base(&ntype, SH_NODE_TEX_MUSGRAVE, "Musgrave Texture", NODE_CLASS_TEXTURE); ntype.declare = file_ns::sh_node_tex_musgrave_declare; node_type_size_preset(&ntype, NODE_SIZE_MIDDLE); node_type_init(&ntype, file_ns::node_shader_init_tex_musgrave); diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_noise.cc b/source/blender/nodes/shader/nodes/node_shader_tex_noise.cc index 74b0ae73a9d..8b4334467b0 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_noise.cc +++ b/source/blender/nodes/shader/nodes/node_shader_tex_noise.cc @@ -21,10 +21,10 @@ #include "BLI_noise.hh" -NODE_STORAGE_FUNCS(NodeTexNoise) - namespace blender::nodes::node_shader_tex_noise_cc { +NODE_STORAGE_FUNCS(NodeTexNoise) + static void sh_node_tex_noise_declare(NodeDeclarationBuilder &b) { b.is_function_node(); @@ -254,7 +254,7 @@ void register_node_type_sh_tex_noise() static bNodeType ntype; - sh_fn_node_type_base(&ntype, SH_NODE_TEX_NOISE, "Noise Texture", NODE_CLASS_TEXTURE, 0); + sh_fn_node_type_base(&ntype, SH_NODE_TEX_NOISE, "Noise Texture", NODE_CLASS_TEXTURE); ntype.declare = file_ns::sh_node_tex_noise_declare; node_type_init(&ntype, file_ns::node_shader_init_tex_noise); node_type_storage( diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_pointdensity.cc b/source/blender/nodes/shader/nodes/node_shader_tex_pointdensity.cc index 8e57be6ee8d..1bc0a4dade0 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_pointdensity.cc +++ b/source/blender/nodes/shader/nodes/node_shader_tex_pointdensity.cc @@ -75,7 +75,7 @@ void register_node_type_sh_tex_pointdensity() static bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_TEX_POINTDENSITY, "Point Density", NODE_CLASS_TEXTURE, 0); + sh_node_type_base(&ntype, SH_NODE_TEX_POINTDENSITY, "Point Density", NODE_CLASS_TEXTURE); node_type_socket_templates( &ntype, file_ns::sh_node_tex_pointdensity_in, file_ns::sh_node_tex_pointdensity_out); node_type_init(&ntype, file_ns::node_shader_init_tex_pointdensity); diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_sky.cc b/source/blender/nodes/shader/nodes/node_shader_tex_sky.cc index 6067bcdbfcc..853a14644b3 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_sky.cc +++ b/source/blender/nodes/shader/nodes/node_shader_tex_sky.cc @@ -214,7 +214,7 @@ void register_node_type_sh_tex_sky() static bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_TEX_SKY, "Sky Texture", NODE_CLASS_TEXTURE, 0); + sh_node_type_base(&ntype, SH_NODE_TEX_SKY, "Sky Texture", NODE_CLASS_TEXTURE); node_type_socket_templates(&ntype, file_ns::sh_node_tex_sky_in, file_ns::sh_node_tex_sky_out); node_type_size_preset(&ntype, NODE_SIZE_MIDDLE); node_type_init(&ntype, file_ns::node_shader_init_tex_sky); diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_voronoi.cc b/source/blender/nodes/shader/nodes/node_shader_tex_voronoi.cc index 85601c60a2a..161b413f3a2 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_voronoi.cc +++ b/source/blender/nodes/shader/nodes/node_shader_tex_voronoi.cc @@ -1344,7 +1344,7 @@ void register_node_type_sh_tex_voronoi() static bNodeType ntype; - sh_fn_node_type_base(&ntype, SH_NODE_TEX_VORONOI, "Voronoi Texture", NODE_CLASS_TEXTURE, 0); + sh_fn_node_type_base(&ntype, SH_NODE_TEX_VORONOI, "Voronoi Texture", NODE_CLASS_TEXTURE); ntype.declare = file_ns::sh_node_tex_voronoi_declare; node_type_init(&ntype, file_ns::node_shader_init_tex_voronoi); node_type_storage( diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_wave.cc b/source/blender/nodes/shader/nodes/node_shader_tex_wave.cc index 4864a14553c..ed7c6fb8710 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_wave.cc +++ b/source/blender/nodes/shader/nodes/node_shader_tex_wave.cc @@ -220,7 +220,7 @@ void register_node_type_sh_tex_wave() static bNodeType ntype; - sh_fn_node_type_base(&ntype, SH_NODE_TEX_WAVE, "Wave Texture", NODE_CLASS_TEXTURE, 0); + sh_fn_node_type_base(&ntype, SH_NODE_TEX_WAVE, "Wave Texture", NODE_CLASS_TEXTURE); ntype.declare = file_ns::sh_node_tex_wave_declare; node_type_size_preset(&ntype, NODE_SIZE_MIDDLE); node_type_init(&ntype, file_ns::node_shader_init_tex_wave); diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_white_noise.cc b/source/blender/nodes/shader/nodes/node_shader_tex_white_noise.cc index 3eb2d507266..51898f42c2a 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_white_noise.cc +++ b/source/blender/nodes/shader/nodes/node_shader_tex_white_noise.cc @@ -196,8 +196,7 @@ void register_node_type_sh_tex_white_noise() static bNodeType ntype; - sh_fn_node_type_base( - &ntype, SH_NODE_TEX_WHITE_NOISE, "White Noise Texture", NODE_CLASS_TEXTURE, 0); + sh_fn_node_type_base(&ntype, SH_NODE_TEX_WHITE_NOISE, "White Noise Texture", NODE_CLASS_TEXTURE); ntype.declare = file_ns::sh_node_tex_white_noise_declare; node_type_init(&ntype, file_ns::node_shader_init_tex_white_noise); node_type_gpu(&ntype, file_ns::gpu_shader_tex_white_noise); diff --git a/source/blender/nodes/shader/nodes/node_shader_uv_along_stroke.cc b/source/blender/nodes/shader/nodes/node_shader_uv_along_stroke.cc index aee5b06f8b9..021f6107f39 100644 --- a/source/blender/nodes/shader/nodes/node_shader_uv_along_stroke.cc +++ b/source/blender/nodes/shader/nodes/node_shader_uv_along_stroke.cc @@ -37,7 +37,7 @@ void register_node_type_sh_uvalongstroke() static bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_UVALONGSTROKE, "UV Along Stroke", NODE_CLASS_INPUT, 0); + sh_node_type_base(&ntype, SH_NODE_UVALONGSTROKE, "UV Along Stroke", NODE_CLASS_INPUT); node_type_socket_templates(&ntype, nullptr, file_ns::sh_node_uvalongstroke_out); nodeRegisterType(&ntype); diff --git a/source/blender/nodes/shader/nodes/node_shader_uvmap.cc b/source/blender/nodes/shader/nodes/node_shader_uvmap.cc index 18975601a05..d93f87bedc0 100644 --- a/source/blender/nodes/shader/nodes/node_shader_uvmap.cc +++ b/source/blender/nodes/shader/nodes/node_shader_uvmap.cc @@ -61,7 +61,7 @@ void register_node_type_sh_uvmap() static bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_UVMAP, "UV Map", NODE_CLASS_INPUT, 0); + sh_node_type_base(&ntype, SH_NODE_UVMAP, "UV Map", NODE_CLASS_INPUT); node_type_socket_templates(&ntype, nullptr, file_ns::sh_node_uvmap_out); node_type_size_preset(&ntype, NODE_SIZE_MIDDLE); node_type_init(&ntype, file_ns::node_shader_init_uvmap); diff --git a/source/blender/nodes/shader/nodes/node_shader_value.cc b/source/blender/nodes/shader/nodes/node_shader_value.cc index 44076ff80ce..2d6aed076c5 100644 --- a/source/blender/nodes/shader/nodes/node_shader_value.cc +++ b/source/blender/nodes/shader/nodes/node_shader_value.cc @@ -55,7 +55,7 @@ void register_node_type_sh_value() static bNodeType ntype; - sh_fn_node_type_base(&ntype, SH_NODE_VALUE, "Value", NODE_CLASS_INPUT, 0); + sh_fn_node_type_base(&ntype, SH_NODE_VALUE, "Value", NODE_CLASS_INPUT); ntype.declare = file_ns::sh_node_value_declare; node_type_gpu(&ntype, file_ns::gpu_shader_value); ntype.build_multi_function = file_ns::sh_node_value_build_multi_function; diff --git a/source/blender/nodes/shader/nodes/node_shader_vector_displacement.cc b/source/blender/nodes/shader/nodes/node_shader_vector_displacement.cc index 765de0ebb89..05a3334487c 100644 --- a/source/blender/nodes/shader/nodes/node_shader_vector_displacement.cc +++ b/source/blender/nodes/shader/nodes/node_shader_vector_displacement.cc @@ -75,7 +75,7 @@ void register_node_type_sh_vector_displacement() static bNodeType ntype; sh_node_type_base( - &ntype, SH_NODE_VECTOR_DISPLACEMENT, "Vector Displacement", NODE_CLASS_OP_VECTOR, 0); + &ntype, SH_NODE_VECTOR_DISPLACEMENT, "Vector Displacement", NODE_CLASS_OP_VECTOR); node_type_socket_templates( &ntype, file_ns::sh_node_vector_displacement_in, file_ns::sh_node_vector_displacement_out); node_type_init(&ntype, file_ns::node_shader_init_vector_displacement); diff --git a/source/blender/nodes/shader/nodes/node_shader_vector_math.cc b/source/blender/nodes/shader/nodes/node_shader_vector_math.cc index e48a668f9f5..f1de3839986 100644 --- a/source/blender/nodes/shader/nodes/node_shader_vector_math.cc +++ b/source/blender/nodes/shader/nodes/node_shader_vector_math.cc @@ -333,7 +333,7 @@ void register_node_type_sh_vect_math() static bNodeType ntype; - sh_fn_node_type_base(&ntype, SH_NODE_VECTOR_MATH, "Vector Math", NODE_CLASS_OP_VECTOR, 0); + sh_fn_node_type_base(&ntype, SH_NODE_VECTOR_MATH, "Vector Math", NODE_CLASS_OP_VECTOR); ntype.declare = file_ns::sh_node_vector_math_declare; ntype.labelfunc = node_vector_math_label; node_type_gpu(&ntype, file_ns::gpu_shader_vector_math); diff --git a/source/blender/nodes/shader/nodes/node_shader_vector_rotate.cc b/source/blender/nodes/shader/nodes/node_shader_vector_rotate.cc index 9a320473115..06df87f3d04 100644 --- a/source/blender/nodes/shader/nodes/node_shader_vector_rotate.cc +++ b/source/blender/nodes/shader/nodes/node_shader_vector_rotate.cc @@ -211,7 +211,7 @@ void register_node_type_sh_vector_rotate() static bNodeType ntype; - sh_fn_node_type_base(&ntype, SH_NODE_VECTOR_ROTATE, "Vector Rotate", NODE_CLASS_OP_VECTOR, 0); + sh_fn_node_type_base(&ntype, SH_NODE_VECTOR_ROTATE, "Vector Rotate", NODE_CLASS_OP_VECTOR); ntype.declare = file_ns::sh_node_vector_rotate_declare; node_type_gpu(&ntype, file_ns::gpu_shader_vector_rotate); node_type_update(&ntype, file_ns::node_shader_update_vector_rotate); diff --git a/source/blender/nodes/shader/nodes/node_shader_vector_transform.cc b/source/blender/nodes/shader/nodes/node_shader_vector_transform.cc index fc6a05d93b6..733ec27cada 100644 --- a/source/blender/nodes/shader/nodes/node_shader_vector_transform.cc +++ b/source/blender/nodes/shader/nodes/node_shader_vector_transform.cc @@ -100,7 +100,7 @@ static int gpu_shader_vect_transform(GPUMaterial *mat, const char *vtransform = "direction_transform_m4v3"; const char *ptransform = "point_transform_m4v3"; - const char *func_name = 0; + const char *func_name = nullptr; NodeShaderVectTransform *nodeprop = (NodeShaderVectTransform *)node->storage; @@ -146,7 +146,7 @@ void register_node_type_sh_vect_transform() static bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_VECT_TRANSFORM, "Vector Transform", NODE_CLASS_OP_VECTOR, 0); + sh_node_type_base(&ntype, SH_NODE_VECT_TRANSFORM, "Vector Transform", NODE_CLASS_OP_VECTOR); node_type_init(&ntype, file_ns::node_shader_init_vect_transform); node_type_socket_templates( &ntype, file_ns::sh_node_vect_transform_in, file_ns::sh_node_vect_transform_out); diff --git a/source/blender/nodes/shader/nodes/node_shader_vertex_color.cc b/source/blender/nodes/shader/nodes/node_shader_vertex_color.cc index c6b67fe7c94..6a8cc25483f 100644 --- a/source/blender/nodes/shader/nodes/node_shader_vertex_color.cc +++ b/source/blender/nodes/shader/nodes/node_shader_vertex_color.cc @@ -56,7 +56,7 @@ void register_node_type_sh_vertex_color() static bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_VERTEX_COLOR, "Vertex Color", NODE_CLASS_INPUT, 0); + sh_node_type_base(&ntype, SH_NODE_VERTEX_COLOR, "Vertex Color", NODE_CLASS_INPUT); node_type_socket_templates(&ntype, nullptr, file_ns::sh_node_vertex_color_out); node_type_init(&ntype, file_ns::node_shader_init_vertex_color); node_type_storage( diff --git a/source/blender/nodes/shader/nodes/node_shader_volume_absorption.cc b/source/blender/nodes/shader/nodes/node_shader_volume_absorption.cc index 6edc29bc6a7..845b5d19e3e 100644 --- a/source/blender/nodes/shader/nodes/node_shader_volume_absorption.cc +++ b/source/blender/nodes/shader/nodes/node_shader_volume_absorption.cc @@ -52,7 +52,7 @@ void register_node_type_sh_volume_absorption() static bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_VOLUME_ABSORPTION, "Volume Absorption", NODE_CLASS_SHADER, 0); + sh_node_type_base(&ntype, SH_NODE_VOLUME_ABSORPTION, "Volume Absorption", NODE_CLASS_SHADER); node_type_socket_templates( &ntype, file_ns::sh_node_volume_absorption_in, file_ns::sh_node_volume_absorption_out); node_type_gpu(&ntype, file_ns::node_shader_gpu_volume_absorption); diff --git a/source/blender/nodes/shader/nodes/node_shader_volume_info.cc b/source/blender/nodes/shader/nodes/node_shader_volume_info.cc index 8e5f62e07e0..d1487c0abbe 100644 --- a/source/blender/nodes/shader/nodes/node_shader_volume_info.cc +++ b/source/blender/nodes/shader/nodes/node_shader_volume_info.cc @@ -59,7 +59,7 @@ void register_node_type_sh_volume_info() static bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_VOLUME_INFO, "Volume Info", NODE_CLASS_INPUT, 0); + sh_node_type_base(&ntype, SH_NODE_VOLUME_INFO, "Volume Info", NODE_CLASS_INPUT); node_type_socket_templates(&ntype, nullptr, file_ns::sh_node_volume_info_out); node_type_gpu(&ntype, file_ns::node_shader_gpu_volume_info); diff --git a/source/blender/nodes/shader/nodes/node_shader_volume_principled.cc b/source/blender/nodes/shader/nodes/node_shader_volume_principled.cc index 5aee5c8d8f6..56b4e56d233 100644 --- a/source/blender/nodes/shader/nodes/node_shader_volume_principled.cc +++ b/source/blender/nodes/shader/nodes/node_shader_volume_principled.cc @@ -137,7 +137,7 @@ void register_node_type_sh_volume_principled() static bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_VOLUME_PRINCIPLED, "Principled Volume", NODE_CLASS_SHADER, 0); + sh_node_type_base(&ntype, SH_NODE_VOLUME_PRINCIPLED, "Principled Volume", NODE_CLASS_SHADER); node_type_socket_templates( &ntype, file_ns::sh_node_volume_principled_in, file_ns::sh_node_volume_principled_out); node_type_size_preset(&ntype, NODE_SIZE_LARGE); diff --git a/source/blender/nodes/shader/nodes/node_shader_volume_scatter.cc b/source/blender/nodes/shader/nodes/node_shader_volume_scatter.cc index 70a5e8f4672..06ca2f578f0 100644 --- a/source/blender/nodes/shader/nodes/node_shader_volume_scatter.cc +++ b/source/blender/nodes/shader/nodes/node_shader_volume_scatter.cc @@ -53,7 +53,7 @@ void register_node_type_sh_volume_scatter() static bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_VOLUME_SCATTER, "Volume Scatter", NODE_CLASS_SHADER, 0); + sh_node_type_base(&ntype, SH_NODE_VOLUME_SCATTER, "Volume Scatter", NODE_CLASS_SHADER); node_type_socket_templates( &ntype, file_ns::sh_node_volume_scatter_in, file_ns::sh_node_volume_scatter_out); node_type_gpu(&ntype, file_ns::node_shader_gpu_volume_scatter); diff --git a/source/blender/nodes/shader/nodes/node_shader_wavelength.cc b/source/blender/nodes/shader/nodes/node_shader_wavelength.cc index 5acb553ea00..c3d3dd79aef 100644 --- a/source/blender/nodes/shader/nodes/node_shader_wavelength.cc +++ b/source/blender/nodes/shader/nodes/node_shader_wavelength.cc @@ -68,7 +68,7 @@ void register_node_type_sh_wavelength() static bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_WAVELENGTH, "Wavelength", NODE_CLASS_CONVERTER, 0); + sh_node_type_base(&ntype, SH_NODE_WAVELENGTH, "Wavelength", NODE_CLASS_CONVERTER); node_type_size_preset(&ntype, NODE_SIZE_MIDDLE); node_type_socket_templates( &ntype, file_ns::sh_node_wavelength_in, file_ns::sh_node_wavelength_out); diff --git a/source/blender/nodes/shader/nodes/node_shader_wireframe.cc b/source/blender/nodes/shader/nodes/node_shader_wireframe.cc index 558393e4406..0069cac52f9 100644 --- a/source/blender/nodes/shader/nodes/node_shader_wireframe.cc +++ b/source/blender/nodes/shader/nodes/node_shader_wireframe.cc @@ -63,7 +63,7 @@ void register_node_type_sh_wireframe() static bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_WIREFRAME, "Wireframe", NODE_CLASS_INPUT, 0); + sh_node_type_base(&ntype, SH_NODE_WIREFRAME, "Wireframe", NODE_CLASS_INPUT); node_type_socket_templates( &ntype, file_ns::sh_node_wireframe_in, file_ns::sh_node_wireframe_out); node_type_gpu(&ntype, file_ns::node_shader_gpu_wireframe); diff --git a/source/blender/nodes/texture/node_texture_util.c b/source/blender/nodes/texture/node_texture_util.c index 1ba693bf4a4..dc5e2bfcd6b 100644 --- a/source/blender/nodes/texture/node_texture_util.c +++ b/source/blender/nodes/texture/node_texture_util.c @@ -50,10 +50,9 @@ bool tex_node_poll_default(bNodeType *UNUSED(ntype), return true; } -void tex_node_type_base( - struct bNodeType *ntype, int type, const char *name, short nclass, short flag) +void tex_node_type_base(struct bNodeType *ntype, int type, const char *name, short nclass) { - node_type_base(ntype, type, name, nclass, flag); + node_type_base(ntype, type, name, nclass); ntype->poll = tex_node_poll_default; ntype->insert_link = node_insert_link_default; diff --git a/source/blender/nodes/texture/node_texture_util.h b/source/blender/nodes/texture/node_texture_util.h index 473cef81359..d53000058a3 100644 --- a/source/blender/nodes/texture/node_texture_util.h +++ b/source/blender/nodes/texture/node_texture_util.h @@ -108,8 +108,7 @@ typedef struct TexDelegate { bool tex_node_poll_default(struct bNodeType *ntype, struct bNodeTree *ntree, const char **r_disabled_hint); -void tex_node_type_base( - struct bNodeType *ntype, int type, const char *name, short nclass, short flag); +void tex_node_type_base(struct bNodeType *ntype, int type, const char *name, short nclass); void tex_input_rgba(float *out, bNodeStack *in, TexParams *params, short thread); void tex_input_vec(float *out, bNodeStack *in, TexParams *params, short thread); diff --git a/source/blender/nodes/texture/nodes/node_texture_at.c b/source/blender/nodes/texture/nodes/node_texture_at.c index a6f8d28db75..41dea303ea2 100644 --- a/source/blender/nodes/texture/nodes/node_texture_at.c +++ b/source/blender/nodes/texture/nodes/node_texture_at.c @@ -58,7 +58,7 @@ void register_node_type_tex_at(void) { static bNodeType ntype; - tex_node_type_base(&ntype, TEX_NODE_AT, "At", NODE_CLASS_DISTORT, 0); + tex_node_type_base(&ntype, TEX_NODE_AT, "At", NODE_CLASS_DISTORT); node_type_socket_templates(&ntype, inputs, outputs); node_type_size(&ntype, 140, 100, 320); node_type_exec(&ntype, NULL, NULL, exec); diff --git a/source/blender/nodes/texture/nodes/node_texture_bricks.c b/source/blender/nodes/texture/nodes/node_texture_bricks.c index 72690d6ccfe..0dc92dc33d0 100644 --- a/source/blender/nodes/texture/nodes/node_texture_bricks.c +++ b/source/blender/nodes/texture/nodes/node_texture_bricks.c @@ -119,11 +119,12 @@ void register_node_type_tex_bricks(void) { static bNodeType ntype; - tex_node_type_base(&ntype, TEX_NODE_BRICKS, "Bricks", NODE_CLASS_PATTERN, NODE_PREVIEW); + tex_node_type_base(&ntype, TEX_NODE_BRICKS, "Bricks", NODE_CLASS_PATTERN); node_type_socket_templates(&ntype, inputs, outputs); node_type_size_preset(&ntype, NODE_SIZE_MIDDLE); node_type_init(&ntype, init); node_type_exec(&ntype, NULL, NULL, exec); + ntype.flag |= NODE_PREVIEW; nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/texture/nodes/node_texture_checker.c b/source/blender/nodes/texture/nodes/node_texture_checker.c index e3c4d44e7f5..62657cd7def 100644 --- a/source/blender/nodes/texture/nodes/node_texture_checker.c +++ b/source/blender/nodes/texture/nodes/node_texture_checker.c @@ -70,9 +70,10 @@ void register_node_type_tex_checker(void) { static bNodeType ntype; - tex_node_type_base(&ntype, TEX_NODE_CHECKER, "Checker", NODE_CLASS_PATTERN, NODE_PREVIEW); + tex_node_type_base(&ntype, TEX_NODE_CHECKER, "Checker", NODE_CLASS_PATTERN); node_type_socket_templates(&ntype, inputs, outputs); node_type_exec(&ntype, NULL, NULL, exec); + ntype.flag |= NODE_PREVIEW; nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/texture/nodes/node_texture_common.c b/source/blender/nodes/texture/nodes/node_texture_common.c index f873ed5e457..b01353bcd21 100644 --- a/source/blender/nodes/texture/nodes/node_texture_common.c +++ b/source/blender/nodes/texture/nodes/node_texture_common.c @@ -161,7 +161,7 @@ void register_node_type_tex_group(void) /* NOTE: Cannot use #sh_node_type_base for node group, because it would map the node type * to the shared #NODE_GROUP integer type id. */ - node_type_base_custom(&ntype, "TextureNodeGroup", "Group", NODE_CLASS_GROUP, 0); + node_type_base_custom(&ntype, "TextureNodeGroup", "Group", NODE_CLASS_GROUP); ntype.type = NODE_GROUP; ntype.poll = tex_node_poll_default; ntype.poll_instance = node_group_poll_instance; diff --git a/source/blender/nodes/texture/nodes/node_texture_compose.c b/source/blender/nodes/texture/nodes/node_texture_compose.c index ffa0e9ae43e..cd918ca8314 100644 --- a/source/blender/nodes/texture/nodes/node_texture_compose.c +++ b/source/blender/nodes/texture/nodes/node_texture_compose.c @@ -58,7 +58,7 @@ void register_node_type_tex_compose(void) { static bNodeType ntype; - tex_node_type_base(&ntype, TEX_NODE_COMPOSE, "Combine RGBA", NODE_CLASS_OP_COLOR, 0); + tex_node_type_base(&ntype, TEX_NODE_COMPOSE, "Combine RGBA", NODE_CLASS_OP_COLOR); node_type_socket_templates(&ntype, inputs, outputs); node_type_exec(&ntype, NULL, NULL, exec); diff --git a/source/blender/nodes/texture/nodes/node_texture_coord.c b/source/blender/nodes/texture/nodes/node_texture_coord.c index d3cad460099..e31fdcafbf2 100644 --- a/source/blender/nodes/texture/nodes/node_texture_coord.c +++ b/source/blender/nodes/texture/nodes/node_texture_coord.c @@ -49,7 +49,7 @@ void register_node_type_tex_coord(void) { static bNodeType ntype; - tex_node_type_base(&ntype, TEX_NODE_COORD, "Coordinates", NODE_CLASS_INPUT, 0); + tex_node_type_base(&ntype, TEX_NODE_COORD, "Coordinates", NODE_CLASS_INPUT); node_type_socket_templates(&ntype, NULL, outputs); node_type_exec(&ntype, NULL, NULL, exec); diff --git a/source/blender/nodes/texture/nodes/node_texture_curves.c b/source/blender/nodes/texture/nodes/node_texture_curves.c index f61e3f36db5..7fed45c5558 100644 --- a/source/blender/nodes/texture/nodes/node_texture_curves.c +++ b/source/blender/nodes/texture/nodes/node_texture_curves.c @@ -65,7 +65,7 @@ void register_node_type_tex_curve_time(void) { static bNodeType ntype; - tex_node_type_base(&ntype, TEX_NODE_CURVE_TIME, "Time", NODE_CLASS_INPUT, 0); + tex_node_type_base(&ntype, TEX_NODE_CURVE_TIME, "Time", NODE_CLASS_INPUT); node_type_socket_templates(&ntype, NULL, time_outputs); node_type_size_preset(&ntype, NODE_SIZE_LARGE); node_type_init(&ntype, time_init); @@ -114,7 +114,7 @@ void register_node_type_tex_curve_rgb(void) { static bNodeType ntype; - tex_node_type_base(&ntype, TEX_NODE_CURVE_RGB, "RGB Curves", NODE_CLASS_OP_COLOR, 0); + tex_node_type_base(&ntype, TEX_NODE_CURVE_RGB, "RGB Curves", NODE_CLASS_OP_COLOR); node_type_socket_templates(&ntype, rgb_inputs, rgb_outputs); node_type_size_preset(&ntype, NODE_SIZE_LARGE); node_type_init(&ntype, rgb_init); diff --git a/source/blender/nodes/texture/nodes/node_texture_decompose.c b/source/blender/nodes/texture/nodes/node_texture_decompose.c index 83922ea03ab..9c3cb6911e1 100644 --- a/source/blender/nodes/texture/nodes/node_texture_decompose.c +++ b/source/blender/nodes/texture/nodes/node_texture_decompose.c @@ -78,7 +78,7 @@ void register_node_type_tex_decompose(void) { static bNodeType ntype; - tex_node_type_base(&ntype, TEX_NODE_DECOMPOSE, "Separate RGBA", NODE_CLASS_OP_COLOR, 0); + tex_node_type_base(&ntype, TEX_NODE_DECOMPOSE, "Separate RGBA", NODE_CLASS_OP_COLOR); node_type_socket_templates(&ntype, inputs, outputs); node_type_exec(&ntype, NULL, NULL, exec); diff --git a/source/blender/nodes/texture/nodes/node_texture_distance.c b/source/blender/nodes/texture/nodes/node_texture_distance.c index 88f3da94706..2f8b28722bd 100644 --- a/source/blender/nodes/texture/nodes/node_texture_distance.c +++ b/source/blender/nodes/texture/nodes/node_texture_distance.c @@ -60,7 +60,7 @@ void register_node_type_tex_distance(void) { static bNodeType ntype; - tex_node_type_base(&ntype, TEX_NODE_DISTANCE, "Distance", NODE_CLASS_CONVERTER, 0); + tex_node_type_base(&ntype, TEX_NODE_DISTANCE, "Distance", NODE_CLASS_CONVERTER); node_type_socket_templates(&ntype, inputs, outputs); node_type_exec(&ntype, NULL, NULL, exec); diff --git a/source/blender/nodes/texture/nodes/node_texture_hueSatVal.c b/source/blender/nodes/texture/nodes/node_texture_hueSatVal.c index 759fb3d43d5..f405c3b0bec 100644 --- a/source/blender/nodes/texture/nodes/node_texture_hueSatVal.c +++ b/source/blender/nodes/texture/nodes/node_texture_hueSatVal.c @@ -107,7 +107,7 @@ void register_node_type_tex_hue_sat(void) { static bNodeType ntype; - tex_node_type_base(&ntype, TEX_NODE_HUE_SAT, "Hue Saturation Value", NODE_CLASS_OP_COLOR, 0); + tex_node_type_base(&ntype, TEX_NODE_HUE_SAT, "Hue Saturation Value", NODE_CLASS_OP_COLOR); node_type_socket_templates(&ntype, inputs, outputs); node_type_size_preset(&ntype, NODE_SIZE_MIDDLE); node_type_exec(&ntype, NULL, NULL, exec); diff --git a/source/blender/nodes/texture/nodes/node_texture_image.c b/source/blender/nodes/texture/nodes/node_texture_image.c index 9c61405ea23..18ae3609407 100644 --- a/source/blender/nodes/texture/nodes/node_texture_image.c +++ b/source/blender/nodes/texture/nodes/node_texture_image.c @@ -108,12 +108,13 @@ void register_node_type_tex_image(void) { static bNodeType ntype; - tex_node_type_base(&ntype, TEX_NODE_IMAGE, "Image", NODE_CLASS_INPUT, NODE_PREVIEW); + tex_node_type_base(&ntype, TEX_NODE_IMAGE, "Image", NODE_CLASS_INPUT); node_type_socket_templates(&ntype, NULL, outputs); node_type_init(&ntype, init); node_type_storage(&ntype, "ImageUser", node_free_standard_storage, node_copy_standard_storage); node_type_exec(&ntype, NULL, NULL, exec); ntype.labelfunc = node_image_label; + ntype.flag |= NODE_PREVIEW; nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/texture/nodes/node_texture_invert.c b/source/blender/nodes/texture/nodes/node_texture_invert.c index 5d3f86c5c9c..7854ac4b5b8 100644 --- a/source/blender/nodes/texture/nodes/node_texture_invert.c +++ b/source/blender/nodes/texture/nodes/node_texture_invert.c @@ -63,7 +63,7 @@ void register_node_type_tex_invert(void) { static bNodeType ntype; - tex_node_type_base(&ntype, TEX_NODE_INVERT, "Invert", NODE_CLASS_OP_COLOR, 0); + tex_node_type_base(&ntype, TEX_NODE_INVERT, "Invert", NODE_CLASS_OP_COLOR); node_type_socket_templates(&ntype, inputs, outputs); node_type_exec(&ntype, NULL, NULL, exec); diff --git a/source/blender/nodes/texture/nodes/node_texture_math.c b/source/blender/nodes/texture/nodes/node_texture_math.c index 4cbe524a96b..2f50f6aaae0 100644 --- a/source/blender/nodes/texture/nodes/node_texture_math.c +++ b/source/blender/nodes/texture/nodes/node_texture_math.c @@ -335,7 +335,7 @@ void register_node_type_tex_math(void) { static bNodeType ntype; - tex_node_type_base(&ntype, TEX_NODE_MATH, "Math", NODE_CLASS_CONVERTER, 0); + tex_node_type_base(&ntype, TEX_NODE_MATH, "Math", NODE_CLASS_CONVERTER); node_type_socket_templates(&ntype, inputs, outputs); ntype.labelfunc = node_math_label; node_type_exec(&ntype, NULL, NULL, exec); diff --git a/source/blender/nodes/texture/nodes/node_texture_mixRgb.c b/source/blender/nodes/texture/nodes/node_texture_mixRgb.c index 044875cce90..5599807d8b1 100644 --- a/source/blender/nodes/texture/nodes/node_texture_mixRgb.c +++ b/source/blender/nodes/texture/nodes/node_texture_mixRgb.c @@ -69,7 +69,7 @@ void register_node_type_tex_mix_rgb(void) { static bNodeType ntype; - tex_node_type_base(&ntype, TEX_NODE_MIX_RGB, "Mix", NODE_CLASS_OP_COLOR, 0); + tex_node_type_base(&ntype, TEX_NODE_MIX_RGB, "Mix", NODE_CLASS_OP_COLOR); node_type_socket_templates(&ntype, inputs, outputs); ntype.labelfunc = node_blend_label; node_type_exec(&ntype, NULL, NULL, exec); diff --git a/source/blender/nodes/texture/nodes/node_texture_output.c b/source/blender/nodes/texture/nodes/node_texture_output.c index 50f41239581..4911ab7ba9e 100644 --- a/source/blender/nodes/texture/nodes/node_texture_output.c +++ b/source/blender/nodes/texture/nodes/node_texture_output.c @@ -166,13 +166,14 @@ void register_node_type_tex_output(void) { static bNodeType ntype; - tex_node_type_base(&ntype, TEX_NODE_OUTPUT, "Output", NODE_CLASS_OUTPUT, NODE_PREVIEW); + tex_node_type_base(&ntype, TEX_NODE_OUTPUT, "Output", NODE_CLASS_OUTPUT); node_type_socket_templates(&ntype, inputs, NULL); node_type_size_preset(&ntype, NODE_SIZE_MIDDLE); node_type_init(&ntype, init); node_type_storage(&ntype, "TexNodeOutput", node_free_standard_storage, copy); node_type_exec(&ntype, NULL, NULL, exec); + ntype.flag |= NODE_PREVIEW; ntype.no_muting = true; nodeRegisterType(&ntype); diff --git a/source/blender/nodes/texture/nodes/node_texture_proc.c b/source/blender/nodes/texture/nodes/node_texture_proc.c index a8a82153e58..8c294b5954d 100644 --- a/source/blender/nodes/texture/nodes/node_texture_proc.c +++ b/source/blender/nodes/texture/nodes/node_texture_proc.c @@ -294,12 +294,13 @@ static void init(bNodeTree *UNUSED(ntree), bNode *node) { \ static bNodeType ntype; \ \ - tex_node_type_base(&ntype, TEX_NODE_PROC + TEXTYPE, Name, NODE_CLASS_TEXTURE, NODE_PREVIEW); \ + tex_node_type_base(&ntype, TEX_NODE_PROC + TEXTYPE, Name, NODE_CLASS_TEXTURE); \ node_type_socket_templates(&ntype, name##_inputs, outputs); \ node_type_size_preset(&ntype, NODE_SIZE_MIDDLE); \ node_type_init(&ntype, init); \ node_type_storage(&ntype, "Tex", node_free_standard_storage, node_copy_standard_storage); \ node_type_exec(&ntype, NULL, NULL, name##_exec); \ + ntype.flag |= NODE_PREVIEW; \ \ nodeRegisterType(&ntype); \ } diff --git a/source/blender/nodes/texture/nodes/node_texture_rotate.c b/source/blender/nodes/texture/nodes/node_texture_rotate.c index 9985499772e..18024a4d41d 100644 --- a/source/blender/nodes/texture/nodes/node_texture_rotate.c +++ b/source/blender/nodes/texture/nodes/node_texture_rotate.c @@ -95,7 +95,7 @@ void register_node_type_tex_rotate(void) { static bNodeType ntype; - tex_node_type_base(&ntype, TEX_NODE_ROTATE, "Rotate", NODE_CLASS_DISTORT, 0); + tex_node_type_base(&ntype, TEX_NODE_ROTATE, "Rotate", NODE_CLASS_DISTORT); node_type_socket_templates(&ntype, inputs, outputs); node_type_exec(&ntype, NULL, NULL, exec); diff --git a/source/blender/nodes/texture/nodes/node_texture_scale.c b/source/blender/nodes/texture/nodes/node_texture_scale.c index d23b1b4d037..d570c73a67b 100644 --- a/source/blender/nodes/texture/nodes/node_texture_scale.c +++ b/source/blender/nodes/texture/nodes/node_texture_scale.c @@ -68,7 +68,7 @@ void register_node_type_tex_scale(void) { static bNodeType ntype; - tex_node_type_base(&ntype, TEX_NODE_SCALE, "Scale", NODE_CLASS_DISTORT, 0); + tex_node_type_base(&ntype, TEX_NODE_SCALE, "Scale", NODE_CLASS_DISTORT); node_type_socket_templates(&ntype, inputs, outputs); node_type_exec(&ntype, NULL, NULL, exec); diff --git a/source/blender/nodes/texture/nodes/node_texture_texture.c b/source/blender/nodes/texture/nodes/node_texture_texture.c index 59e2e9be581..083ae67ccb6 100644 --- a/source/blender/nodes/texture/nodes/node_texture_texture.c +++ b/source/blender/nodes/texture/nodes/node_texture_texture.c @@ -94,9 +94,10 @@ void register_node_type_tex_texture(void) { static bNodeType ntype; - tex_node_type_base(&ntype, TEX_NODE_TEXTURE, "Texture", NODE_CLASS_INPUT, NODE_PREVIEW); + tex_node_type_base(&ntype, TEX_NODE_TEXTURE, "Texture", NODE_CLASS_INPUT); node_type_socket_templates(&ntype, inputs, outputs); node_type_exec(&ntype, NULL, NULL, exec); + ntype.flag |= NODE_PREVIEW; nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/texture/nodes/node_texture_translate.c b/source/blender/nodes/texture/nodes/node_texture_translate.c index 2eef3132a18..732cd0a89a1 100644 --- a/source/blender/nodes/texture/nodes/node_texture_translate.c +++ b/source/blender/nodes/texture/nodes/node_texture_translate.c @@ -64,7 +64,7 @@ void register_node_type_tex_translate(void) { static bNodeType ntype; - tex_node_type_base(&ntype, TEX_NODE_TRANSLATE, "Translate", NODE_CLASS_DISTORT, 0); + tex_node_type_base(&ntype, TEX_NODE_TRANSLATE, "Translate", NODE_CLASS_DISTORT); node_type_socket_templates(&ntype, inputs, outputs); node_type_exec(&ntype, NULL, NULL, exec); diff --git a/source/blender/nodes/texture/nodes/node_texture_valToNor.c b/source/blender/nodes/texture/nodes/node_texture_valToNor.c index 5ccd44b8bf0..3f0d4fb668e 100644 --- a/source/blender/nodes/texture/nodes/node_texture_valToNor.c +++ b/source/blender/nodes/texture/nodes/node_texture_valToNor.c @@ -80,7 +80,7 @@ void register_node_type_tex_valtonor(void) { static bNodeType ntype; - tex_node_type_base(&ntype, TEX_NODE_VALTONOR, "Value to Normal", NODE_CLASS_CONVERTER, 0); + tex_node_type_base(&ntype, TEX_NODE_VALTONOR, "Value to Normal", NODE_CLASS_CONVERTER); node_type_socket_templates(&ntype, inputs, outputs); node_type_exec(&ntype, NULL, NULL, exec); diff --git a/source/blender/nodes/texture/nodes/node_texture_valToRgb.c b/source/blender/nodes/texture/nodes/node_texture_valToRgb.c index 2446ef05e0c..844a4188663 100644 --- a/source/blender/nodes/texture/nodes/node_texture_valToRgb.c +++ b/source/blender/nodes/texture/nodes/node_texture_valToRgb.c @@ -63,7 +63,7 @@ void register_node_type_tex_valtorgb(void) { static bNodeType ntype; - tex_node_type_base(&ntype, TEX_NODE_VALTORGB, "ColorRamp", NODE_CLASS_CONVERTER, 0); + tex_node_type_base(&ntype, TEX_NODE_VALTORGB, "ColorRamp", NODE_CLASS_CONVERTER); node_type_socket_templates(&ntype, valtorgb_in, valtorgb_out); node_type_size_preset(&ntype, NODE_SIZE_LARGE); node_type_init(&ntype, valtorgb_init); @@ -105,7 +105,7 @@ void register_node_type_tex_rgbtobw(void) { static bNodeType ntype; - tex_node_type_base(&ntype, TEX_NODE_RGBTOBW, "RGB to BW", NODE_CLASS_CONVERTER, 0); + tex_node_type_base(&ntype, TEX_NODE_RGBTOBW, "RGB to BW", NODE_CLASS_CONVERTER); node_type_socket_templates(&ntype, rgbtobw_in, rgbtobw_out); node_type_exec(&ntype, NULL, NULL, rgbtobw_exec); diff --git a/source/blender/nodes/texture/nodes/node_texture_viewer.c b/source/blender/nodes/texture/nodes/node_texture_viewer.c index 1c22561bec4..e40cdb66cb1 100644 --- a/source/blender/nodes/texture/nodes/node_texture_viewer.c +++ b/source/blender/nodes/texture/nodes/node_texture_viewer.c @@ -55,11 +55,12 @@ void register_node_type_tex_viewer(void) { static bNodeType ntype; - tex_node_type_base(&ntype, TEX_NODE_VIEWER, "Viewer", NODE_CLASS_OUTPUT, NODE_PREVIEW); + tex_node_type_base(&ntype, TEX_NODE_VIEWER, "Viewer", NODE_CLASS_OUTPUT); node_type_socket_templates(&ntype, inputs, outputs); node_type_exec(&ntype, NULL, NULL, exec); ntype.no_muting = true; + ntype.flag |= NODE_PREVIEW; nodeRegisterType(&ntype); } diff --git a/source/blender/windowmanager/intern/wm_operator_props.c b/source/blender/windowmanager/intern/wm_operator_props.c index a5887fc07b3..ebd6719d54d 100644 --- a/source/blender/windowmanager/intern/wm_operator_props.c +++ b/source/blender/windowmanager/intern/wm_operator_props.c @@ -184,6 +184,9 @@ void WM_operator_properties_filesel(wmOperatorType *ot, prop = RNA_def_boolean( ot->srna, "filter_usd", (filter & FILE_TYPE_USD) != 0, "Filter USD files", ""); RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE); + prop = RNA_def_boolean( + ot->srna, "filter_obj", (filter & FILE_TYPE_OBJECT_IO) != 0, "Filter OBJ files", ""); + RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE); prop = RNA_def_boolean(ot->srna, "filter_volume", (filter & FILE_TYPE_VOLUME) != 0, |