예제 #1
0
void WinRenderFrontend::FatalError (POVMSObjectPtr msg, POVMSObjectPtr, int)
{
  int l = sizeof (ErrorFilename) ;
  if (POVMSUtil_GetString (msg, kPOVAttrib_FileName, ErrorFilename, &l) == kNoErr)
  {
    POVMSUtil_GetInt (msg, kPOVAttrib_Line, (int *) &ErrorLine) ;
    POVMSUtil_GetInt (msg, kPOVAttrib_Column, (int *) &ErrorCol) ;
  }
  l = sizeof (ErrorMessage) ;
  POVMSUtil_GetString (msg, kPOVAttrib_EnglishText, ErrorMessage, &l) ;
}
예제 #2
0
int POVMS_Object::GetString(POVMSType key, char *str, int maxlen)
{
	int err;

	err = POVMSUtil_GetString(&data, key, str, &maxlen);
	if(err != kNoErr)
		throw err;

	return maxlen;
}
예제 #3
0
int POVMS_Object::GetString(POVMSType key, char *str, int maxlen)
{
    int err;

    err = POVMSUtil_GetString(&data, key, str, &maxlen);
    if(err != pov_base::kNoErr)
        throw POV_EXCEPTION_CODE(err);

    return maxlen;
}
예제 #4
0
int SetCommandOption(POVMSObjectPtr msg, POVMSType key, SHELLDATA *data)
{
   POVMSObject obj;
   int len = POV_MAX_CMD_LENGTH;
   int err;

   err = POVMSObject_Get(msg, &obj, key);
   if(err == 0)
   {
      err = POVMSUtil_GetString(&obj, kPOVAttrib_CommandString, data->Command, &len);
      if(err == 0)
      {
         int ret = 0;

         err = POVMSUtil_GetInt(&obj, kPOVAttrib_ReturnAction, &ret);
         if(err == 0)
         {
       		data->Inverse = (ret < 0);
         	if(ret < 0)
         		ret = -ret;
            switch(ret)
            {
               case 'I':
               case 'i':
                  data->Ret = IGNORE_RET;
                  break;
               case 'Q':
               case 'q':
                  data->Ret = QUIT_RET;
                  break;
               case 'U':
               case 'u':
                  data->Ret = USER_RET;
                  break;
               case 'F':
               case 'f':
                  data->Ret = FATAL_RET;
                  break;
               case 'S':
               case 's':
                  data->Ret = SKIP_ONCE_RET;
                  break;
               case 'A':
               case 'a':
                  data->Ret = ALL_SKIP_RET;
                  break;
            }
         }
      }
      (void)POVMSObject_Delete(&obj);
   }

   return err;
}
예제 #5
0
std::string POVMS_Object::GetString(POVMSType key)
{
    int len = 0;
    int err;

    err = POVMSUtil_GetStringLength(&data, key, &len);
    if(err != pov_base::kNoErr)
        throw POV_EXCEPTION_CODE(err);

    char *strptr = new char[len];

    err = POVMSUtil_GetString(&data, key, strptr, &len);
    if(err != pov_base::kNoErr)
    {
        delete[] strptr;
        throw POV_EXCEPTION_CODE(err);
    }

    std::string str(strptr);

    delete[] strptr;

    return str;
}
예제 #6
0
int Receive_RenderOptions(POVMSObjectPtr msg, POVMSObjectPtr result, int, void *)
{
   POVMSAttribute attr;
   POVMSInt i;
   POVMSFloat f;
   POVMSBool b;
   int l = 0;

   if(Cooperate_Render_Flag != 1)
      return -1;

   if(gStartedStreamMessage == NULL)
   {
      if(POVMSObject_New(&gStartedStreamMessageData, kPOVMSType_WildCard) == kNoErr)
         gStartedStreamMessage = &gStartedStreamMessageData;
   }

   l = sizeof(unsigned long);
   if(POVMSObject_Get(msg, &attr, kPOVAttrib_PreviewRefCon) == kNoErr)
   {
      (void)POVMSAttr_Get(&attr, kPOVMSType_WildCard, (void *)(&opts.Preview_RefCon), &l);
      (void)POVMSAttr_Delete(&attr);
   }
   if(POVMSUtil_GetInt(msg, kPOVAttrib_WarningLevel, &i) == 0)
      opts.Warning_Level = i;
   if(POVMSUtil_GetInt(msg, kPOVAttrib_Height, &i) == 0)
      Frame.Screen_Height = i;
   if(POVMSUtil_GetInt(msg, kPOVAttrib_Width, &i) == 0)
      Frame.Screen_Width = i;
   if(POVMSUtil_GetFloat(msg, kPOVAttrib_StartColumn, &f) == 0)
   {
      if(f >= 0.0 && f < 1.0)
      {
         opts.First_Column = -1;
         opts.First_Column_Percent = f;
      }
      else
         opts.First_Column = (int)f;
   }
   if(POVMSUtil_GetFloat(msg, kPOVAttrib_EndColumn, &f) == 0)
   {
      if((f >= 0.0 && f < 1.0) || ((f >= 0.0 && f <= 1.0) && (opts.First_Column < 1)))
      {
         opts.Last_Column = -1;
         opts.Last_Column_Percent = f;
      }
      else
         opts.Last_Column = (int)f;
   }
   if(POVMSUtil_GetFloat(msg, kPOVAttrib_StartRow, &f) == 0)
   {
      if(f >= 0.0 && f < 1.0)
      {
         opts.First_Line = -1;
         opts.First_Line_Percent = f;
      }
      else
         opts.First_Line = (int)f;
   }
   if(POVMSUtil_GetFloat(msg, kPOVAttrib_EndRow, &f) == 0)
   {
      if((f >= 0.0 && f < 1.0) || ((f >= 0.0 && f <= 1.0) && (opts.First_Line < 1)))
      {
         opts.Last_Line = -1;
         opts.Last_Line_Percent = f;
      }
      else
         opts.Last_Line = (int)f;
   }
   if(POVMSUtil_GetBool(msg, kPOVAttrib_TestAbort, &b) == 0)
   {
      if(b == true)
         opts.Options |= EXITENABLE;
      else
         opts.Options &= ~EXITENABLE;
   }
   if(POVMSUtil_GetInt(msg, kPOVAttrib_TestAbortCount, &i) == 0)
      opts.Abort_Test_Counter = i;
   if(POVMSUtil_GetBool(msg, kPOVAttrib_ContinueTrace, &b) == 0)
   {
      if(b == true)
         opts.Options |= CONTINUE_TRACE;
      else
         opts.Options &= ~CONTINUE_TRACE;
   }
   l = FILE_NAME_LENGTH;
   (void)POVMSUtil_GetString(msg, kPOVAttrib_CreateIni, opts.Ini_Output_File_Name, &l);
   if(POVMSUtil_GetFloat(msg, kPOVAttrib_Clock, &f) == 0)
      opts.FrameSeq.Clock_Value = f;
   if(POVMSUtil_GetInt(msg, kPOVAttrib_InitialFrame, &i) == 0)
      opts.FrameSeq.InitialFrame = i;
   if(POVMSUtil_GetInt(msg, kPOVAttrib_FinalFrame, &i) == 0)
      opts.FrameSeq.FinalFrame = i;
   if(POVMSUtil_GetFloat(msg, kPOVAttrib_InitialClock, &f) == 0)
      opts.FrameSeq.InitialClock = f;
   if(POVMSUtil_GetFloat(msg, kPOVAttrib_FinalClock, &f) == 0)
      opts.FrameSeq.FinalClock = f;
   if(POVMSUtil_GetFloat(msg, kPOVAttrib_SubsetStartFrame, &f) == 0)
   {
      if(f > 0.0 && f < 1.0)
         opts.FrameSeq.SubsetStartPercent = f;
      else
         opts.FrameSeq.SubsetStartFrame = (int)f;
   }
   if(POVMSUtil_GetFloat(msg, kPOVAttrib_SubsetEndFrame, &f) == 0)
   {
      if(f > 0.0 && f < 1.0)
         opts.FrameSeq.SubsetEndPercent = f;
      else
         opts.FrameSeq.SubsetEndFrame = (int)f;
   }
   if(POVMSUtil_GetBool(msg, kPOVAttrib_CyclicAnimation, &b) == 0)
   {
      if(b == true)
         opts.Options |= CYCLIC_ANIMATION;
      else
         opts.Options &= ~CYCLIC_ANIMATION;
   }
   if(POVMSUtil_GetBool(msg, kPOVAttrib_FieldRender, &b) == 0)
      opts.FrameSeq.Field_Render_Flag = b;
   if(POVMSUtil_GetBool(msg, kPOVAttrib_OddField, &b) == 0)
      opts.FrameSeq.Odd_Field_Flag = b;
   if(POVMSUtil_GetBool(msg, kPOVAttrib_PauseWhenDone, &b) == 0)
   {
      if(b == true)
         opts.Options |= PROMPTEXIT;
      else
         opts.Options &= ~PROMPTEXIT;
   }
   if(POVMSUtil_GetBool(msg, kPOVAttrib_Verbose, &b) == 0)
   {
      if(b == true)
         opts.Options |= VERBOSE;
      else
         opts.Options &= ~VERBOSE;
   }
   if(POVMSUtil_GetBool(msg, kPOVAttrib_DrawVistas, &b) == 0)
   {
      if(b == true)
         opts.Options |= USE_VISTA_DRAW;
      else
         opts.Options &= ~USE_VISTA_DRAW;
   }
   if(POVMSUtil_GetBool(msg, kPOVAttrib_Display, &b) == 0)
   {
      if(b == true)
         opts.Options |= DISPLAY;
      else
         opts.Options &= ~DISPLAY;
   }
   if(POVMSUtil_GetInt(msg, kPOVAttrib_VideoMode, &i) == 0)
      opts.DisplayFormat = (char)toupper(i);
   if(POVMSUtil_GetInt(msg, kPOVAttrib_Palette, &i) == 0)
      opts.PaletteOption = (char)toupper(i);
   if(POVMSUtil_GetFloat(msg, kPOVAttrib_DisplayGamma, &f) == 0)
   {
      if(f > 0.0)
         opts.DisplayGamma = f;
   }
   if(POVMSUtil_GetInt(msg, kPOVAttrib_PreviewStartSize, &i) == 0)
      opts.PreviewGridSize_Start = i;
   if(POVMSUtil_GetInt(msg, kPOVAttrib_PreviewEndSize, &i) == 0)
      opts.PreviewGridSize_End = i;
   if(POVMSUtil_GetBool(msg, kPOVAttrib_OutputToFile, &b) == 0)
   {
      if(b == true)
         opts.Options |= DISKWRITE;
      else
         opts.Options &= ~DISKWRITE;
   }
   if(POVMSUtil_GetInt(msg, kPOVAttrib_OutputFileType, &i) == 0)
      opts.OutputFormat = (char)tolower(i);
   if(POVMSUtil_GetInt(msg, kPOVAttrib_Compression, &i) == 0)
   {
      if(opts.OutputFormat == 'j')
      {
         opts.OutputQuality = i;
         opts.OutputQuality = max(0, opts.OutputQuality);
         opts.OutputQuality = min(100, opts.OutputQuality);
      }
   }
   if(POVMSUtil_GetBool(msg, kPOVAttrib_OutputAlpha, &b) == 0)
   {
      if(b == true)
         opts.Options |= OUTPUT_ALPHA;
      else
         opts.Options &= ~OUTPUT_ALPHA;
   }
   if(POVMSUtil_GetInt(msg, kPOVAttrib_BitsPerColor, &i) == 0)
   {
      if(opts.OutputFormat != 'j')
      {
         opts.OutputQuality = i;
         opts.OutputQuality = max(5, opts.OutputQuality);
         opts.OutputQuality = min(16, opts.OutputQuality);
      }
   }
   l = FILE_NAME_LENGTH;
   if(POVMSUtil_GetString(msg, kPOVAttrib_OutputFile, opts.Output_File_Name, &l) == 0)
   {
      if(!strcmp(opts.Output_File_Name, "-") || !strcmp(opts.Output_File_Name, "stdout"))
      {
         strcpy(opts.Output_File_Name, "stdout");
         opts.Options |= TO_STDOUT;
      }
   }
   l = FILE_NAME_LENGTH;
   opts.Ini_Output_File_Name[0] = '\0';
   (void)POVMSUtil_GetString(msg, kPOVAttrib_CreateIni, opts.Ini_Output_File_Name, &l);

#if PRECISION_TIMER_AVAILABLE
   if(POVMSUtil_GetBool(msg, kPOVAttrib_CreateHistogram, &b) == 0)
      opts.histogram_on = b;
   if(POVMSUtil_GetInt(msg, kPOVAttrib_HistogramFileType, &i) == 0)
   {
      char *def_ext = NULL;

      switch(i)
      {
         case 'C':
         case 'c':
            opts.histogram_type = CSV;
    	    opts.histogram_file_type = NO_FILE; // CSV has special handling in histogram output, so this is correct [trf]
            def_ext = ".csv";
            break;
         case 'S':
         case 's':
            opts.histogram_type = SYS ;
    	    opts.histogram_file_type = SYS_FILE;
            def_ext = SYS_DEF_EXT;
            break ;
         case 'P' :
         case 'p' :
            opts.histogram_type = PPM;
    	    opts.histogram_file_type = PPM_FILE;
            def_ext = ".ppm";
            break;
         case 'T':
         case 't':
            opts.histogram_type = TARGA;
    	    opts.histogram_file_type = TGA_FILE;
            def_ext = ".tga";
            break;
         case 'N':
         case 'n':
            opts.histogram_type = PNG;
    	    opts.histogram_file_type = PNG_FILE;
            def_ext = ".png";
            break;
         default:
            opts.histogram_type = TARGA;
    	    opts.histogram_file_type = TGA_FILE;
            Warning(0, "Unknown histogram output type '%c'.", (char)i);
            break ;
      }

      // Process the histogram file name now, if it hasn't
      // yet been specified, and in case it isn't set later.
      if (opts.histogram_on && (opts.Histogram_File_Name[0] == '\0') && (def_ext != NULL))
         sprintf(opts.Histogram_File_Name, "histgram%s", def_ext);
   }
   l = FILE_NAME_LENGTH;
   if(POVMSUtil_GetString(msg, kPOVAttrib_HistogramFile, opts.Histogram_File_Name, &l) == 0)
   {
      if(opts.histogram_on && opts.Histogram_File_Name[0] == '\0')
      {
         char *def_ext = NULL;

         switch(opts.histogram_type)
         {
				case CSV:	 def_ext = ".csv"; break;
				case TARGA:  def_ext = ".tga"; break;
				case PNG:	 def_ext = ".png"; break;
				case PPM:	 def_ext = ".ppm"; break;
				case SYS:	 def_ext = SYS_DEF_EXT; break;
				case NONE:	 def_ext = ""; break;	/* To quiet warnings */
         }
         sprintf(opts.Histogram_File_Name, "histgram%s", def_ext);
      }
   }
   if(POVMSUtil_GetInt(msg, kPOVAttrib_HistogramGridSizeX, &i) == 0)
      opts.histogram_x = i;
   if(POVMSUtil_GetInt(msg, kPOVAttrib_HistogramGridSizeY, &i) == 0)
      opts.histogram_y = i;

#endif /* PRECISION_TIMER_AVAILABLE */
   (void)SetCommandOption(msg, kPOVAttrib_PreSceneCommand, &opts.Shellouts[PRE_SCENE_SHL]);
   (void)SetCommandOption(msg, kPOVAttrib_PreFrameCommand, &opts.Shellouts[PRE_FRAME_SHL]);
   (void)SetCommandOption(msg, kPOVAttrib_PostSceneCommand, &opts.Shellouts[POST_SCENE_SHL]);
   (void)SetCommandOption(msg, kPOVAttrib_PostFrameCommand, &opts.Shellouts[POST_FRAME_SHL]);
   (void)SetCommandOption(msg, kPOVAttrib_UserAbortCommand, &opts.Shellouts[USER_ABORT_SHL]);
   (void)SetCommandOption(msg, kPOVAttrib_FatalErrorCommand, &opts.Shellouts[FATAL_SHL]);
   l = FILE_NAME_LENGTH;
   if(POVMSUtil_GetString(msg, kPOVAttrib_InputFile, opts.Input_File_Name, &l) == 0)
   {
      if(!strcmp(opts.Input_File_Name, "-") || !strcmp(opts.Input_File_Name, "stdin"))
      {
         strcpy (opts.Input_File_Name, "stdin");
         opts.Options |= FROM_STDIN;
      }
   }
   if(POVMSObject_Get(msg, &attr, kPOVAttrib_LibraryPath) == 0)
   {
      int cnt = 0;

      if(POVMSAttrList_Count(&attr, &cnt) == 0)
      {
         POVMSAttribute item;
         int ii,iii;
         bool rem = false;

         for(ii = 1; ii <= cnt; ii++)
         {
            if(POVMSAttrList_GetNth(&attr, ii, &item) == 0)
            {
               l = 0;
               if(POVMSAttr_Size(&item, &l) == 0)
               {
                  if(l > 0)
                  {
                     if(opts.Library_Path_Index >= MAX_LIBRARIES)
                        Error ("Too many library directories specified.");
                     opts.Library_Paths[opts.Library_Path_Index] = (char *)POV_MALLOC(l, "library paths");
                     if(POVMSAttr_Get(&item, kPOVMSType_CString, opts.Library_Paths[opts.Library_Path_Index], &l) == 0)
                        rem = false;
                     else
                        rem = true;

                     // remove path again if the same one already exists
                     for(iii = 0; iii < opts.Library_Path_Index - 1; iii++)
                     {
                        if(strcmp(opts.Library_Paths[iii], opts.Library_Paths[opts.Library_Path_Index]) == 0)
                        {
                           rem = true;
                           break;
                        }
                     }

                     if(rem == true)
                     {
                        POV_FREE(opts.Library_Paths[opts.Library_Path_Index]);
                        opts.Library_Paths[opts.Library_Path_Index] = NULL;
                     }
                     else
                        opts.Library_Path_Index++;
                  }
               }
               (void)POVMSAttr_Delete(&item);
            }
         }
      }
      (void)POVMSAttr_Delete(&attr);
   }
   if(POVMSUtil_GetFloat(msg, kPOVAttrib_Version, &f) == 0)
      opts.Language_Version = (int)(f * 100 + 0.5);

   (void)POVMSObject_Delete(gStartedStreamMessage);
   (void)POVMSObject_New(gStartedStreamMessage, kPOVMSType_WildCard);
   if(POVMSUtil_GetBool(msg, kPOVAttrib_AllConsole, &b) == 0)
   {
      (void)POVMSUtil_SetBool(gStartedStreamMessage, kPOVAttrib_AllConsole, b);
      (void)POVMSUtil_SetBool(gStartedStreamMessage, kPOVAttrib_DebugConsole, b);
      (void)POVMSUtil_SetBool(gStartedStreamMessage, kPOVAttrib_FatalConsole, b);
      (void)POVMSUtil_SetBool(gStartedStreamMessage, kPOVAttrib_RenderConsole, b);
      (void)POVMSUtil_SetBool(gStartedStreamMessage, kPOVAttrib_StatisticsConsole, b);
      (void)POVMSUtil_SetBool(gStartedStreamMessage, kPOVAttrib_WarningConsole, b);
   }
   if(POVMSUtil_GetBool(msg, kPOVAttrib_DebugConsole, &b) == 0)
      (void)POVMSUtil_SetBool(gStartedStreamMessage, kPOVAttrib_DebugConsole, b);
   if(POVMSUtil_GetBool(msg, kPOVAttrib_FatalConsole, &b) == 0)
      (void)POVMSUtil_SetBool(gStartedStreamMessage, kPOVAttrib_FatalConsole, b);
   if(POVMSUtil_GetBool(msg, kPOVAttrib_RenderConsole, &b) == 0)
      (void)POVMSUtil_SetBool(gStartedStreamMessage, kPOVAttrib_RenderConsole, b);
   if(POVMSUtil_GetBool(msg, kPOVAttrib_StatisticsConsole, &b) == 0)
      (void)POVMSUtil_SetBool(gStartedStreamMessage, kPOVAttrib_StatisticsConsole, b);
   if(POVMSUtil_GetBool(msg, kPOVAttrib_WarningConsole, &b) == 0)
     (void)POVMSUtil_SetBool(gStartedStreamMessage, kPOVAttrib_WarningConsole, b);
   for(i = 0; i < gStreamTypeUtilDataCount; i++)
   {
      l = 0;
      if(POVMSUtil_GetStringLength(msg, gStreamTypeUtilData[i], &l) == kNoErr)
      {
          char *str = (char *)POV_MALLOC(l, "stream name");

          if(POVMSUtil_GetString(msg, gStreamTypeUtilData[i], str, &l) == kNoErr)
          {
             if(l > 1)
             {
                if(IsTrue(str) == true)
                   (void)POVMSUtil_SetString(gStartedStreamMessage, gStreamTypeUtilData[i], gStreamDefaultFile[i]);
                else if(IsFalse(str) == false)
                   (void)POVMSUtil_SetString(gStartedStreamMessage, gStreamTypeUtilData[i], str);
             }
          }

          POV_FREE(str);
      }
   }

   if(POVMSUtil_GetInt(msg, kPOVAttrib_Quality, &i) == 0)
   {
      opts.Quality = i;
      /* Emit a warning about the "radiosity" quality levels for
       * now.   We can get rid of this some time in the future.
       */
      if ((opts.Quality == 10) || (opts.Quality == 11))
      {
         Warning(0, "Quality settings 10 and 11 are no longer valid.");
         opts.Quality = 9;
      }
      else if ((opts.Quality < 0) || (opts.Quality > 9))
          Error("Illegal Quality setting.");
      opts.Quality_Flags = Quality_Values[opts.Quality];
   }
   if(POVMSUtil_GetBool(msg, kPOVAttrib_Bounding, &b) == 0)
      opts.Use_Slabs = b;
   if(POVMSUtil_GetInt(msg, kPOVAttrib_BoundingThreshold, &i) == 0)
   {
      if(opts.BBox_Threshold < 1)
         Warning(0, "Too small bounding threshold adjusted to its minimum of one.");
      opts.BBox_Threshold = max(1, i);
   }
   if(POVMSUtil_GetBool(msg, kPOVAttrib_LightBuffer, &b) == 0)
   {
      if(b == true)
         opts.Options |= USE_LIGHT_BUFFER;
      else
         opts.Options &= ~USE_LIGHT_BUFFER;
   }
   if(POVMSUtil_GetBool(msg, kPOVAttrib_VistaBuffer, &b) == 0)
   {
      if(b == true)
         opts.Options |= USE_VISTA_BUFFER;
      else
         opts.Options &= ~USE_VISTA_BUFFER;
   }
   if(POVMSUtil_GetBool(msg, kPOVAttrib_Radiosity, &b) == 0)
   {
      Warning(0, "Radiosity commandline/INI switch is not needed in POV-Ray 3.5.\n"
                 "Add a radiosity{}-block to your scene to turn on radiosity.");
   }
   if(POVMSUtil_GetBool(msg, kPOVAttrib_RemoveBounds, &b) == 0)
   {
      if(b == true)
         opts.Options |= REMOVE_BOUNDS;
      else
         opts.Options &= ~REMOVE_BOUNDS;
   }
   if(POVMSUtil_GetBool(msg, kPOVAttrib_SplitUnions, &b) == 0)
   {
      if(b == true)
         opts.Options |= SPLIT_UNION;
      else
         opts.Options &= ~SPLIT_UNION;
   }
   if(POVMSUtil_GetBool(msg, kPOVAttrib_Antialias, &b) == 0)
   {
      if(b == true)
         opts.Options |= ANTIALIAS;
      else
         opts.Options &= ~ANTIALIAS;
   }
   if(POVMSUtil_GetInt(msg, kPOVAttrib_SamplingMethod, &i) == 0)
      opts.Tracing_Method = i;
   if(POVMSUtil_GetFloat(msg, kPOVAttrib_AntialiasThreshold, &f) == 0)
      opts.Antialias_Threshold = f;
   if(POVMSUtil_GetInt(msg, kPOVAttrib_AntialiasDepth, &i) == 0)
   {
      opts.AntialiasDepth = i;
      if(opts.AntialiasDepth < 1)
         opts.AntialiasDepth = 1;
      if(opts.AntialiasDepth > 9)
         opts.AntialiasDepth = 9;
   }
   if(POVMSUtil_GetBool(msg, kPOVAttrib_Jitter, &b) == 0)
   {
      if(b == true)
         opts.Options |= JITTER;
      else
         opts.Options &= ~JITTER;
   }
   if(POVMSUtil_GetFloat(msg, kPOVAttrib_JitterAmount, &f) == 0)
   {
      opts.JitterScale = f;
      if(opts.JitterScale <= 0.0)
         opts.Options &= ~JITTER;
   }
   if(POVMSObject_Exist(msg, kPOVAttrib_IncludeHeader) == 0)
   {
      l = FILE_NAME_LENGTH;
      opts.Header_File_Name[0] = '\0';
      (void)POVMSUtil_GetString(msg, kPOVAttrib_IncludeHeader, opts.Header_File_Name, &l);
   }
   (void)POVMSObject_Get(msg, &opts.Declared_Variables, kPOVAttrib_Declare);

   if(result != NULL)
      (void)BuildRenderOptions(result);

   return 0;
}
예제 #7
0
void WinRenderFrontend::RenderOptions (POVMSObjectPtr msg, POVMSObjectPtr, int)
{
  int                   l ;
  char                  dir [_MAX_PATH] ;
  char                  str [_MAX_PATH] ;
  char                  path [_MAX_PATH] ;
  char                  file [_MAX_PATH] ;
  POVMSBool             b ;
  ProcessRenderOptions  options ;

  if (!running_demo && !demo_mode)
  {
    WritePrivateProfileString ("LastRender", "SceneFile", "", EngineIniFileName) ;
    WritePrivateProfileString ("LastRender", "OutputFile", "", EngineIniFileName) ;
    WritePrivateProfileString ("LastRender", "HistogramFile", "", EngineIniFileName) ;
    WritePrivateProfileString ("LastRender", "IniOutputFile", "", EngineIniFileName) ;
  }

  GetCurrentDirectory (sizeof (dir), dir) ;
  WritePrivateProfileString ("LastRender", "CurrentDirectory", dir, EngineIniFileName) ;
  str [0] = '\0' ;
  l = sizeof (str) ;
  if (POVMSUtil_GetString (msg, kPOVAttrib_InputFile, str, &l) == kNoErr)
  {
    splitpath (str, path, file) ;
    if (!running_demo && !demo_mode)
      WritePrivateProfileString ("LastRender", "SourceFile", get_full_name (file), EngineIniFileName) ;
    sprintf (dir, "POV-Ray - parsing '%s'", file) ;
    SetWindowText (main_window, dir) ;
    splitfn (str, NULL, file, NULL) ;
    if (!running_demo && !demo_mode)
      WritePrivateProfileString ("LastRender", "SceneFile", file, EngineIniFileName) ;
  }
  if (POVMSUtil_GetBool (msg, kPOVAttrib_OutputToFile, &b) == kNoErr && b == true)
  {
    str [0] = '\0' ;
    if (POVMSUtil_GetString (msg, kPOVAttrib_OutputFile, str, &l) == kNoErr)
    {
      splitpath (str, path, NULL) ;
      if (path [0] == '\0')
      {
        l = sizeof (path) ;
        if (POVMSUtil_GetString (msg, kPOVAttrib_OutputPath, path, &l) != kNoErr)
          path [0] = '\0' ;
        if (path [0] != '\0')
        {
          // path is expected to end with a '\'
          strcpy (output_file_name, path) ;
          strcat (output_file_name, str) ;
        }
        else
          strcpy (output_file_name, get_full_name (str)) ;
      }
      else
        strcpy (output_file_name, str) ;
      if (!running_demo && !demo_mode)
        WritePrivateProfileString ("LastRender", "OutputFile", output_file_name, EngineIniFileName) ;
      output_to_file = str [0] != '\0' ;
    }
  }
  else
    output_to_file = false ;

  if (!running_demo && !demo_mode)
  {
    if (POVMSUtil_GetBool (msg, kPOVAttrib_CreateHistogram, &b) == kNoErr && b == true)
    {
      str [0] = '\0' ;
      l = sizeof (str) ;
      if (POVMSUtil_GetString (msg, kPOVAttrib_CreateHistogram, str, &l) == kNoErr)
        WritePrivateProfileString ("LastRender", "HistogramFile", get_full_name (str), EngineIniFileName) ;
    }

    str [0] = '\0' ;
    l = sizeof (str) ;
    if (POVMSUtil_GetString (msg, kPOVAttrib_CreateIni, str, &l) == kNoErr && str [0] != '\0')
      WritePrivateProfileString ("LastRender", "IniOutputFile", get_full_name (str), EngineIniFileName) ;

    write_rerun_information (msg, &options) ;
    PutPrivateProfileInt ("Statistics", "StartRender", time (NULL), CurrentRerunFileName) ;

    str [0] = '\0' ;
    l = sizeof (str) ;
    if (POVMSUtil_GetString (msg, kPOVAttrib_CreateIni, str, &l) == kNoErr && str [0] != '\0')
      options.WriteFile (str, msg) ;
  }
}