瀏覽代碼

replace old group 'with' keyword with 'on' and 'includes'

David Rose 21 年之前
父節點
當前提交
49b7bcdc1d
共有 2 個文件被更改,包括 34 次插入7 次删除
  1. 7 3
      pandatool/src/egg-palettize/eggPalettize.cxx
  2. 27 4
      pandatool/src/palettizer/txaFile.cxx

+ 7 - 3
pandatool/src/egg-palettize/eggPalettize.cxx

@@ -506,7 +506,7 @@ describe_input_file() {
             "be written to the directory specified by -ds on the command "
             "line.\n\n");
 
-  show_text("  :group groupname [dir dirname] [with group1 group2 ...]", 10,
+  show_text("  :group groupname [dir dirname] [on group1 group2 ...] [includes group1 group2 ...]", 10,
             "This defines a palette group, a logical division of textures.  "
             "Each texture is assigned to one or more palette groups before "
             "being placed in any palette image; the palette images are "
@@ -520,10 +520,14 @@ describe_input_file() {
             "on the groups they are assigned to.\n\n"
 
             "Palette groups can also be hierarchically related.  The "
-            "keyword 'with' specifies any number of groups that this "
+            "keyword 'on' specifies any number of groups that this "
             "palette group depends on; if a texture has already been "
             "assigned to one of this group's dependent groups, it will "
-            "not need to be assigned to this group.\n\n");
+            "not need to be assigned to this group.  This also implicitly "
+            "specifies a dir if one has not already been specified.\n\n"
+
+            "The keyword 'includes' names one or more groups that depend "
+            "on this group.\n\n");
 
 
   nout <<

+ 27 - 4
pandatool/src/palettizer/txaFile.cxx

@@ -216,15 +216,25 @@ parse_group_line(const vector_string &words) {
 
   enum State {
     S_none,
-    S_with,
+    S_on,
+    S_includes,
     S_dir,
   };
   State state = S_none;
 
+  bool first_on = false;
+
   while (wi != words.end()) {
     const string &word = (*wi);
     if (word == "with") {
-      state = S_with;
+      // Deprecated keyword: "with" means the same thing as "on".
+      state = S_on;
+
+    } else if (word == "on") {
+      state = S_on;
+
+    } else if (word == "includes") {
+      state = S_includes;
 
     } else if (word == "dir") {
       state = S_dir;
@@ -235,8 +245,21 @@ parse_group_line(const vector_string &words) {
         nout << "Invalid keyword: " << word << "\n";
         return false;
 
-      case S_with:
-        group->group_with(pal->get_palette_group(word));
+      case S_on:
+        {
+          PaletteGroup *on_group = pal->get_palette_group(word);
+          if (first_on) {
+            if (!group->has_dirname() && on_group->has_dirname()) {
+              group->set_dirname(on_group->get_dirname());
+            }
+            first_on = false;
+          }
+          group->group_with(on_group);
+        }
+        break;
+
+      case S_includes:
+        pal->get_palette_group(word)->group_with(group);
         break;
 
       case S_dir: