Skocz do zawartości
View in the app

A better way to browse. Learn more.

Max3D.pl

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Napisano

hej,

 

zaczynam naukę pisania skryptów w pythonie i mam takie proste pytanie.

Mam niecałe 1k obiektów, i chciałbym żeby cześć z nich została zaznaczona. Napisałem taką prostą pętle ale nie działa. Proszę o jakieś rady.obiekty nazywaja się file1_# czyli file1_1,file1,_2 itd

 

import maya.cmds as cmds

import random

 

 

Idu = random.uniform(0, 967)

 

 

nameD=["geo1|file1_",+Idu]

 

 

for i in range(0,100):

# cmds.ls(nameD)

cmds.select(nameD,replace=True)

Edytowane przez Lzja

  • Odpowiedzi 3
  • Wyświetleń 5,1k
  • Created
  • Ostatniej odpowiedzi

Top Posters In This Topic

Napisano

napisałem sobie coś podobnego w melu:

 

select -r "*file1_*";

 

string $selekcja[] = `ls -os -fl`;

string $selekcjaNowa[];

clear $selekcjaNowa;

 

for ($licznik = 0; $licznik

if ( rand(0,1)> 0.5 ) $selekcjaNowa[size($selekcjaNowa)] = $selekcja[$licznik];

 

select -r $selekcjaNowa;

 

 

 

Co prawda skrypt w założeniu zostawiał losową selekcję z zaznaczenia, lecz nie szkodzi mu to zaznaczenie wymusić w pierwszej linii.

Budowana jest tablica z nową selekcją - tak by setki tysięcy obiektów/vertexów nie zaznaczały się po kolei blokując viewport.

Powinieneś z łatwością przepisać to pod pythona.

Napisano

Możesz użyć random.sample

https://docs.python.org/2/library/random.html

 

import maya.cmds as cmds
import random

# clear the active list
cmds.select( clear=True )

# select all dag objects and all dependency nodes
cmds.select( all=True )

obj =cmds.ls( selection=True )

num_to_select = 5 # set the number to select here.
list_of_random_items = random.sample(obj, num_to_select)

# clear the active list
cmds.select( clear=True )

for item in list_of_random_items:
   cmds.select(item, add=True )

Jeśli chcesz dodać odpowiedź, zaloguj się lub zarejestruj nowe konto

Powiadomienie o plikach cookie

Wykorzystujemy cookies. Przeczytaj więcej Polityka prywatności

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.