Fix T49086: UV Along Stroke can be set as vector input for environment texture
authorSergey Sharybin <sergey.vfx@gmail.com>
Wed, 17 Aug 2016 12:51:25 +0000 (14:51 +0200)
committerSergey Sharybin <sergey.vfx@gmail.com>
Wed, 17 Aug 2016 12:51:25 +0000 (14:51 +0200)
source/blender/editors/space_node/node_templates.c

index 09594ab543cc50d9e2133dcd7ec9e9bfdeef0840..ec525e684b0c72def3048c3844dcebf885472671 100644 (file)
@@ -428,6 +428,20 @@ static int ui_node_item_name_compare(const void *a, const void *b)
        return BLI_natstrcmp(type_a->ui_name, type_b->ui_name);
 }
 
+static bool ui_node_item_special_poll(const bNodeTree *UNUSED(ntree),
+                                      const bNodeType *ntype)
+{
+       if (STREQ(ntype->idname, "ShaderNodeUVAlongStroke")) {
+               /* TODO(sergey): Currently we don't have Freestyle nodes edited from
+                * the buttons context, so can ignore it's nodes completely.
+                *
+                * However, we might want to do some extra checks here later.
+                */
+               return false;
+       }
+       return true;
+}
+
 static void ui_node_menu_column(NodeLinkArg *arg, int nclass, const char *cname)
 {
        bNodeTree *ntree = arg->ntree;
@@ -452,11 +466,17 @@ static void ui_node_menu_column(NodeLinkArg *arg, int nclass, const char *cname)
        BLI_array_declare(sorted_ntypes);
 
        NODE_TYPES_BEGIN(ntype) {
-               if (compatibility && !(ntype->compatibility & compatibility))
+               if (compatibility && !(ntype->compatibility & compatibility)) {
                        continue;
+               }
 
-               if (ntype->nclass != nclass)
+               if (ntype->nclass != nclass) {
                        continue;
+               }
+
+               if (!ui_node_item_special_poll(ntree, ntype)) {
+                       continue;
+               }
 
                BLI_array_append(sorted_ntypes, ntype);
        }