Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#5585: Add a few methods to the MaterialManager interface to copy/cre…
…ate/rename/remove materials
- Loading branch information
1 parent
111f74e
commit 8f5456c
Showing
3 changed files
with
98 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Some interface tests | ||
|
||
print("bc_rat can be modified" if GlobalMaterialManager.materialCanBeModified('bc_rat') else "bc_rat cannot be modified") | ||
|
||
bcRatCopy = GlobalMaterialManager.copyMaterial('bc_rat', 'bc_rat_copy') | ||
|
||
print("Got a copy of bc_rat named {0}".format(bcRatCopy.getName())) | ||
print("The copy can be modified" if GlobalMaterialManager.materialCanBeModified(bcRatCopy.getName()) else "The copy cannot be modified?") | ||
|
||
print("Removing the copy again...") | ||
GlobalMaterialManager.removeMaterial(bcRatCopy.getName()) | ||
|
||
print('Create an empty material named textures/python/blah...') | ||
newMaterial = GlobalMaterialManager.createEmptyMaterial('textures/python/blah') | ||
|
||
print("The new material can be modified" if GlobalMaterialManager.materialCanBeModified(newMaterial.getName()) else "The new material cannot be modified?") | ||
|
||
renameResult = GlobalMaterialManager.renameMaterial(newMaterial.getName(), newMaterial.getName() + '_renamed') | ||
print("The rename operation was successful" if renameResult else "The rename operation failed") | ||
|
||
# Do something with the new material | ||
print('The existing material reference now has the name {0}'.format(newMaterial.getName())) | ||
|
||
print("Removing {0} again...".format(newMaterial.getName())) | ||
GlobalMaterialManager.removeMaterial(newMaterial.getName()) | ||
|
||
print('--- Done ---') | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters