mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-29 08:15:18 -04:00
maya: Allow more than three eggObjectTypes in a Maya model
Closes #1134
This commit is contained in:
parent
fa73657d03
commit
73a2d29c39
@ -1,6 +1,6 @@
|
|||||||
//
|
//
|
||||||
// This is a sample mel script to flag a Maya node with one, two, or
|
// This is a sample mel script to flag a Maya node with at least
|
||||||
// three eggObjectTypes* attributes. These attributes are used to tag
|
// one eggObjectTypes* attribute. These attributes are used to tag
|
||||||
// geometry with special meaning to Panda. There are a handful of
|
// geometry with special meaning to Panda. There are a handful of
|
||||||
// attribute values that are predefined within Panda, but you can also
|
// attribute values that are predefined within Panda, but you can also
|
||||||
// make up your own attribute values, and define an arbitrary egg
|
// make up your own attribute values, and define an arbitrary egg
|
||||||
@ -28,42 +28,22 @@
|
|||||||
// direct/src/configfiles/direct.prc.pp for examples of this.
|
// direct/src/configfiles/direct.prc.pp for examples of this.
|
||||||
//
|
//
|
||||||
|
|
||||||
global proc eggObjectFlags()
|
global proc eggObjectFlags() {
|
||||||
{
|
string $sel[] =`ls -sl`;
|
||||||
string $sel[] =`ls -sl`;
|
|
||||||
for ($i in $sel)
|
|
||||||
{
|
|
||||||
string $attrName = "eggObjectTypes";
|
|
||||||
|
|
||||||
// Modify this line as needed to add your own object types.
|
// Modify this line as needed to add your own object types.
|
||||||
string $eggFlags = "none:portal:polylight:seq24:seq12:indexed:model:dcs:barrier:sphere:tube:trigger:trigger-sphere:bubble:ghost:keep-all-uvsets";
|
string $eggFlags = "none:portal:polylight:seq24:seq12:indexed:model:dcs:barrier:sphere:tube:trigger:trigger-sphere:bubble:ghost:keep-all-uvsets";
|
||||||
|
|
||||||
string $object = ($i + ".eggObjectTypes");
|
for ($i in $sel) {
|
||||||
|
string $attrName = "eggObjectTypes";
|
||||||
if( `objExists ($object + "1")` )
|
string $object = ($i + "." + $attrName);
|
||||||
{
|
|
||||||
|
int $num = 1;
|
||||||
if( `objExists ($object + "2")` )
|
|
||||||
{
|
while (`objExists ($object + $num)`) {
|
||||||
|
$num++;
|
||||||
if( `objExists ($object + "3")` )
|
|
||||||
{
|
|
||||||
warning("No More Egg Object Types Supported");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
addAttr -ln ($attrName + "3") -k 1 -at "enum" -en ($eggFlags) $i;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
addAttr -ln ($attrName + "2") -k 1 -at "enum" -en ($eggFlags) $i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
addAttr -ln ($attrName + "1") -k 1 -at "enum" -en ($eggFlags) $i;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
addAttr -ln ($attrName + $num) -k 1 -at "enum" -en ($eggFlags) $i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -32,6 +32,8 @@
|
|||||||
#include <maya/MGlobal.h>
|
#include <maya/MGlobal.h>
|
||||||
#include "post_maya_include.h"
|
#include "post_maya_include.h"
|
||||||
|
|
||||||
|
#include <sstream>
|
||||||
|
|
||||||
using std::string;
|
using std::string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -341,13 +343,21 @@ get_egg_group(MayaNodeDesc *node_desc) {
|
|||||||
MObject dag_object = node_desc->get_dag_path().node();
|
MObject dag_object = node_desc->get_dag_path().node();
|
||||||
string object_type;
|
string object_type;
|
||||||
LVector3d value;
|
LVector3d value;
|
||||||
if (get_enum_attribute(dag_object, "eggObjectTypes1", object_type)) {
|
|
||||||
egg_group->add_object_type(object_type);
|
for (unsigned int i = 1; ; i++) {
|
||||||
}
|
std::ostringstream attr;
|
||||||
if (get_enum_attribute(dag_object, "eggObjectTypes2", object_type)) {
|
attr << "eggObjectTypes" << i;
|
||||||
egg_group->add_object_type(object_type);
|
|
||||||
}
|
if (!get_enum_attribute(dag_object, attr.str(), object_type)) {
|
||||||
if (get_enum_attribute(dag_object, "eggObjectTypes3", object_type)) {
|
if (i < 3) {
|
||||||
|
// Support out-of-order legacy object types.
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// We have run out of object types to add.
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
egg_group->add_object_type(object_type);
|
egg_group->add_object_type(object_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user