void UGatherTextFromAssetsCommandlet::ProcessPackages( const TArray< UPackage* >& PackagesToProcess )
{
	for( int32 i = 0; i < PackagesToProcess.Num(); ++i )
	{
		UPackage* Package = PackagesToProcess[i];
		TArray<UObject*> Objects;
		GetObjectsWithOuter(Package, Objects);

		for( int32 j = 0; j < Objects.Num(); ++j )
		{
			UObject* Object = Objects[j];
			if ( Object->IsA( UBlueprint::StaticClass() ) )
			{
				UBlueprint* Blueprint = Cast<UBlueprint>( Object );

				if( Blueprint->GeneratedClass != NULL )
				{
					ProcessObject( Blueprint->GeneratedClass->GetDefaultObject(), Package );
				}
				else
				{
					UE_LOG(LogGatherTextFromAssetsCommandlet, Warning, TEXT("%s - Invalid generated class!"), *Blueprint->GetFullName());
				}
			}
			else if( Object->IsA( UDialogueWave::StaticClass() ) )
			{
				UDialogueWave* DialogueWave = Cast<UDialogueWave>( Object );
				ProcessDialogueWave( DialogueWave );
			}

			ProcessObject( Object, Package );
		}
	}
}
Ejemplo n.º 2
0
// Process():
bool ObjectShadowOptions_Interface::Process() {
  int total = 0;
  if( limit_to == 0 ) {
    for( LWItemID item = (*iteminfo->first)( LWI_OBJECT, NULL ); item != NULL; item = (*iteminfo->next)( item ) )
      total++;
  } else {
    for( total=0; ui->selItems[total] != NULL; total++ ) { ; }
  }

  LWProgressPanel progress( global, total );
  progress.SetAbortMessage( "ObjectShadowOptions Abort", "Abort Processing?  Note that some object may have already been affected", NULL );
  char buffer[ 1024 ];

  progress.Open( "Object Shadow Options Processing..." );

  int processed = 0;
  bool aborted = false;
  if( limit_to == 0 ) {
    int i = 0;
    for( LWItemID item = (*iteminfo->first)( LWI_OBJECT, NULL ); item != NULL; item = (*iteminfo->next)( item ) ) {
      sprintf( buffer, "Processing \"%s\"...", (*iteminfo->name)( item ) );
      if( !progress.Handle( ++i, buffer ) ) {
        (*message->info)( "Object Shadow Options: Processing aborted by user.", NULL );
        aborted = true;
        break;
      }

      if( ProcessObject( item ) )
        processed++;
    }
  } else {
    for( int i=0; ui->selItems[i] != NULL; i++ ) { 
      sprintf( buffer, "Processing \"%s\"...", (*iteminfo->name)( ui->selItems[i] ) );
      if( !progress.Handle( i, buffer ) ) {
        (*message->info)( "Object Shadow Options: Processing aborted by user.", NULL );
        aborted = true;
        break;
      }

      if( ProcessObject( ui->selItems[i] ) )
        processed++;
    }
  }

  if( progress.IsOpen() )
    progress.Close();

  // Reselect Items
  ReselectItems();

  if( !aborted ) {
    sprintf( buffer, "ObjectShadowOptions:  Successfully processed %d of %d objects", processed, total );
    (*message->info)( buffer , NULL );
  }

  return true;
}
Ejemplo n.º 3
0
ProcessHandler::ProcessHandler()
{
	CString iniFileName=FolderHelper::GetModuleFileName().c_str();
	iniFileName.Replace(_T(".exe"),_T(".ini"));
	TCHAR *textBuffer=EP_NEW TCHAR[MAX_STRING_LENGTH];

	int procIndex=0;

	while(1)
	{
		CString processString=_T("Process");
		processString.AppendFormat(_T("%d"),procIndex);

		memset(textBuffer,0,sizeof(TCHAR)*MAX_STRING_LENGTH);
		GetPrivateProfileString(processString.GetString(),_T("CommandLine"),_T(""),textBuffer,MAX_STRING_LENGTH,iniFileName.GetString());
		CString commandLine=textBuffer;
		if(commandLine.GetLength()>0)
		{
			ProcessObject *newObj=EP_NEW ProcessObject(procIndex);
			m_processList.push_back(newObj);
		}
		else
			break;
		procIndex++;
	}
	EP_DELETE[] textBuffer;


	

}
Ejemplo n.º 4
0
void TestSharedPointers(void)
{
	shared_ptr<CPrintable> ptr1(new CPrintable("1")); // create object 1
	shared_ptr<CPrintable> ptr2(new CPrintable("2")); // create object 2
	ptr1 = ptr2; // destroy object 1
	ptr2 = shared_ptr<CPrintable>(new CPrintable("3")); // used as a return value
	ProcessObject(ptr1); // call a function
	CPrintable o1("bad");
	//ptr1 = &o1; // Syntax error! It's on the stack....
	//
	CPrintable *o2 = new CPrintable("bad2");
	//ptr1 = o2; // Syntax error! Use the next line to do this...
	ptr1 = shared_ptr<CPrintable>(o2);
	// You can even use shared_ptr on ints!
	shared_ptr<int> a(new int);
	shared_ptr<int> b(new int);
	*a = 5;
	*b = 6;
	const int *q = a.get(); // use this for reading in multithreaded code
							// this is especially cool - you can also use it in lists.
	std::list< shared_ptr<int> > intList;
	std::list< shared_ptr<IPrintable> > printableList;
	for (int i = 0; i<100; ++i)
	{
		intList.push_back(shared_ptr<int>(new int(rand())));
		printableList.push_back(shared_ptr<IPrintable>(new CPrintable("list")));
	}
}
void FReferenceChainSearch::PerformSearch()
{
	UE_LOG(LogReferenceChain, Log, TEXT("Searching referencers for %s. This may take several minutes."), *ObjectToFind->GetName());
	
	for (FRawObjectIterator It;It;++It)
	{
		UObject* CurrentObject = *It;

		ProcessObject(CurrentObject);
	}

	BuildRefGraph();
}
Ejemplo n.º 6
0
void CPDF_TextPage::ParseTextPage() {
  m_bIsParsed = false;
  m_TextBuf.Clear();
  m_CharList.clear();
  m_pPreTextObj = nullptr;
  ProcessObject();

  m_bIsParsed = true;
  m_CharIndex.clear();
  const int nCount = CountChars();
  if (nCount)
    m_CharIndex.push_back(0);

  for (int i = 0; i < nCount; ++i) {
    int indexSize = pdfium::CollectionSize<int>(m_CharIndex);
    const PAGECHAR_INFO& charinfo = m_CharList[i];
    if (charinfo.m_Flag == FPDFTEXT_CHAR_GENERATED ||
        (charinfo.m_Unicode != 0 && !IsControlChar(charinfo)) ||
        (charinfo.m_Unicode == 0 && charinfo.m_CharCode != 0)) {
      if (indexSize % 2) {
        m_CharIndex.push_back(1);
      } else {
        if (indexSize <= 0)
          continue;
        m_CharIndex[indexSize - 1] += 1;
      }
    } else {
      if (indexSize % 2) {
        if (indexSize <= 0)
          continue;
        m_CharIndex[indexSize - 1] = i + 1;
      } else {
        m_CharIndex.push_back(i + 1);
      }
    }
  }
  int indexSize = pdfium::CollectionSize<int>(m_CharIndex);
  if (indexSize % 2)
    m_CharIndex.erase(m_CharIndex.begin() + indexSize - 1);
}
Ejemplo n.º 7
0
// Process():
bool Nullify_Interface::Process() {
  // Build Item List
  BuildItemList();

  // Build Hierarchy
  LWItemHierarchy base( LWITEM_NULL );
  base.BuildChildList( iteminfo );
  base.ReadLayoutSelection( iteminfo, ui );

  #ifdef _DEBUG
    ofstream out( "i:\\Nullify_Hierarchy.txt" );
    base.OutputToStream( out, iteminfo );
    out.close();
  #endif

  // Select decendants, if applicable
  if( nullify_decendants )
    base.SelectSelectedsChildren( true );

  // Set up the progress bar
  char title_string[256];
  sprintf( title_string, "Nullify -- %c2000-2001 Joe Angell, TM Productions", 169 );

  progress.SetTotal( items.NumElements() - 1 );
  progress.SetCurrent( 1 );
  progress.SetAbortMessage( "Confirm Nullify Abort", "Do you really want to abort nullification?",
                            "Note that some objects may have already been converted to nulls." );
  progress.Open( title_string );

  // Process each object
  (*generic->evaluate)( generic->data, "AutoConfirm 1" );
  ProcessObject( &base );
  (*generic->evaluate)( generic->data, "AutoConfirm 0" );

  // Reselect Items
  ReselectItems();

  return true;
}
Ejemplo n.º 8
0
PyObject *_internal_encode(_YajlEncoder *self, PyObject *obj)
{
    yajl_gen generator = NULL;
    yajl_gen_config genconfig = { 0, NULL};
    yajl_gen_status status;
    struct StringAndUsedCount sauc;

    /* initialize context for our printer function which
     * performs low level string appending, using the python
     * string implementation as a chunked growth buffer */
    sauc.used = 0;
    sauc.str = lowLevelStringAlloc(PY_YAJL_CHUNK_SZ);

    generator = yajl_gen_alloc2(py_yajl_printer, &genconfig, NULL, (void *) &sauc);

    self->_generator = generator;

    status = ProcessObject(self, obj);

    yajl_gen_free(generator);
    self->_generator = NULL;

    /* if resize failed inside our printer function we'll have a null sauc.str */
    if (!sauc.str) {
        PyErr_SetObject(PyExc_ValueError, PyString_FromString("Allocation failure"));
        return NULL;
    }

    if (status != yajl_gen_status_ok) {
        PyErr_SetObject(PyExc_ValueError, PyString_FromString("Failed to process"));
        Py_XDECREF(sauc.str);
        return NULL;
    }

    /* truncate to used size, and resize will handle the null plugging */
    _PyString_Resize(&sauc.str, sauc.used);

    return sauc.str;
}
Ejemplo n.º 9
0
// ProcessObject():
//  If this returns false, this index in the child array should be
//   processed again, since what was there has been deleted.
bool Nullify_Interface::ProcessObject( LWItemHierarchy *object ) {
  if( object->GetType() == LWI_OBJECT ) {
    if( object->GetIsSelected() ) {
      // Update the progress bar
      char progress_string[1024];
      sprintf( progress_string, "Nullifying \"%s\"...", (*iteminfo->name)( object->GetID() ) );

      progress.IncrementBar( progress_string );
      if( !progress.Handle() )
        return true;

      // Store the original name
      char buffer[1024];
      if( store_original_name ) {
        const char *tag;
        for( int t=1; tag = (*iteminfo->getTag)( object->GetID(), t ); t++ ) {
          if( tag == NULL )
            break;

          if( strnicmp( tag, "OriginalItem", 12 ) == 0 )
            break;
        } 

        if( tag == NULL )
          t = 0;

        int type = 1;
        if( ((*objectinfo->numPoints)(   object->GetID() ) <= 1) &&
            ((*objectinfo->numPolygons)( object->GetID() ) == 0) ) {
          type = 0;
        }

        sprintf( buffer, "OriginalItem %d %s", type, (*objectinfo->filename)( object->GetID() ) );
        (*iteminfo->setTag)( object->GetID(), t, buffer );
      }

      // Replace the object
      sprintf( buffer, "SelectItem %x", object->GetID() );
      (*generic->evaluate)( generic->data, buffer );
      
      sprintf( buffer, "ReplaceWithNull %s%s%s", prefix, DirStrings::HasFile( (*objectinfo->filename)( object->GetID() ) ), suffix );
      (*generic->evaluate)( generic->data, buffer );

      // Disable Shadows
      if( disable_shadows ) {
        unsigned int shadow = (*objectinfo->shadowOpts)( object->GetID() );
        if( shadow & LWOSHAD_SELF )
          (*generic->evaluate)( generic->data, "SelfShadow" );

        if( shadow & LWOSHAD_CAST )
          (*generic->evaluate)( generic->data, "CastShadow" );

        if( shadow & LWOSHAD_RECEIVE )
          (*generic->evaluate)( generic->data, "ReceiveShadow" );
      }

      // Remove the bones
      if( remove_bones ) {
        if( object->AreAnyChildrenBones() )
          (*generic->evaluate)( generic->data, "ClearAllBones" );
      }

      // Remove MorphMixer
      if( remove_morph_mixer ) {
        const char *server_name = (const char *)1;
        for( unsigned long i=1; server_name != NULL; i++ ) {
          server_name = (*iteminfo->server)( ui->selItems[0], LWDISPLACEMENT_HCLASS, i );
          if( server_name == NULL )
            break;

          if( stricmp( server_name, "LW_MorphMixer" ) == 0 ) {
            sprintf( buffer, "RemoveServer %s %d", LWDISPLACEMENT_HCLASS, i );
            (*generic->evaluate)( generic->data, buffer );
            break;
          }
        }
      }
    }
  }

  // Process Children
  for( unsigned long i=0; i < object->GetChildren().NumElements(); i++ ) {
    if( !ProcessObject( object->GetChildren()[i] ) )
      i--;  // Item was deleted; do this index again

    if( !progress.IsOpen() )
      return true;
  }

  return true;
}
Ejemplo n.º 10
0
static yajl_gen_status ProcessObject(_YajlEncoder *self, PyObject *object)
{
    yajl_gen handle = (yajl_gen)(self->_generator);
    yajl_gen_status status = yajl_gen_in_error_state;
    PyObject *iterator, *item;
    unsigned short int decref = 0;

    if (object == Py_None) {
        return yajl_gen_null(handle);
    }
    if (object == Py_True) {
        return yajl_gen_bool(handle, 1);
    }
    if (object == Py_False) {
        return yajl_gen_bool(handle, 0);
    }
    if (PyUnicode_Check(object)) {
        object = PyUnicode_AsUTF8String(object);
        decref = 1;
    }
    if (PyString_Check(object)) {
        const unsigned char *buffer = NULL;
        Py_ssize_t length;
        PyString_AsStringAndSize(object, (char **)&buffer, &length);
        status = yajl_gen_string(handle, buffer, (unsigned int)(length));
        if (decref) {
            Py_XDECREF(object);
        }
        return status;
    }
    if (PyInt_Check(object)) {
        return yajl_gen_integer(handle, PyInt_AsLong(object));
    }
    if (PyLong_Check(object)) {
        return yajl_gen_integer(handle, PyLong_AsLong(object));
    }
    if (PyFloat_Check(object)) {
        return yajl_gen_double(handle, PyFloat_AsDouble(object));
    }
    if (PyList_Check(object)) {
        /*
         * Recurse and handle the list 
         */
        iterator = PyObject_GetIter(object);
        if (iterator == NULL)
            goto exit;
        status = yajl_gen_array_open(handle);
        while ((item = PyIter_Next(iterator))) {
            status = ProcessObject(self, item);
            Py_XDECREF(item);
        }
        Py_XDECREF(iterator);
        status = yajl_gen_array_close(handle);
        return status;
    }
    if (PyDict_Check(object)) {
        PyObject *key, *value;
        Py_ssize_t position = 0;

        status = yajl_gen_map_open(handle);
        while (PyDict_Next(object, &position, &key, &value)) {
            status = ProcessObject(self, key);
            status = ProcessObject(self, value);
        }
        return yajl_gen_map_close(handle);
    }

        
    exit:
        return yajl_gen_in_error_state;
}