|
|
@ -19,29 +19,31 @@ from PyHSPlasma import * |
|
|
|
|
|
|
|
|
|
|
|
from .base import PlasmaModifierProperties |
|
|
|
from .base import PlasmaModifierProperties |
|
|
|
from ...exporter import ExportError |
|
|
|
from ...exporter import ExportError |
|
|
|
|
|
|
|
from ... import idprops |
|
|
|
|
|
|
|
|
|
|
|
game_versions = [("pvPrime", "Ages Beyond Myst (63.11)", "Targets the original Uru (Live) game"), |
|
|
|
game_versions = [("pvPrime", "Ages Beyond Myst (63.11)", "Targets the original Uru (Live) game"), |
|
|
|
("pvPots", "Path of the Shell (63.12)", "Targets the most recent offline expansion pack"), |
|
|
|
("pvPots", "Path of the Shell (63.12)", "Targets the most recent offline expansion pack"), |
|
|
|
("pvMoul", "Myst Online: Uru Live (70)", "Targets the most recent online game")] |
|
|
|
("pvMoul", "Myst Online: Uru Live (70)", "Targets the most recent online game")] |
|
|
|
|
|
|
|
|
|
|
|
class PlasmaVersionedNodeTree(bpy.types.PropertyGroup): |
|
|
|
class PlasmaVersionedNodeTree(idprops.IDPropMixin, bpy.types.PropertyGroup): |
|
|
|
name = StringProperty(name="Name") |
|
|
|
name = StringProperty(name="Name") |
|
|
|
version = EnumProperty(name="Version", |
|
|
|
version = EnumProperty(name="Version", |
|
|
|
description="Plasma versions this node tree exports under", |
|
|
|
description="Plasma versions this node tree exports under", |
|
|
|
items=game_versions, |
|
|
|
items=game_versions, |
|
|
|
options={"ENUM_FLAG"}, |
|
|
|
options={"ENUM_FLAG"}, |
|
|
|
default=set(list(zip(*game_versions))[0])) |
|
|
|
default=set(list(zip(*game_versions))[0])) |
|
|
|
node_tree_name = StringProperty(name="Node Tree", |
|
|
|
node_tree = PointerProperty(name="Node Tree", |
|
|
|
description="Node Tree to export") |
|
|
|
description="Node Tree to export", |
|
|
|
|
|
|
|
type=bpy.types.NodeTree) |
|
|
|
node_name = StringProperty(name="Node Ref", |
|
|
|
node_name = StringProperty(name="Node Ref", |
|
|
|
description="Attach a reference to this node") |
|
|
|
description="Attach a reference to this node") |
|
|
|
|
|
|
|
|
|
|
|
@property |
|
|
|
@classmethod |
|
|
|
def node_tree(self): |
|
|
|
def _idprop_mapping(cls): |
|
|
|
try: |
|
|
|
return {"node_tree": "node_tree_name"} |
|
|
|
return bpy.data.node_groups[self.node_tree_name] |
|
|
|
|
|
|
|
except KeyError: |
|
|
|
def _idprop_sources(self): |
|
|
|
raise ExportError("Node Tree '{}' does not exist!".format(self.node_tree_name)) |
|
|
|
return {"node_tree_name": bpy.data.node_groups} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class PlasmaAdvancedLogic(PlasmaModifierProperties): |
|
|
|
class PlasmaAdvancedLogic(PlasmaModifierProperties): |
|
|
@ -60,19 +62,22 @@ class PlasmaAdvancedLogic(PlasmaModifierProperties): |
|
|
|
for i in self.logic_groups: |
|
|
|
for i in self.logic_groups: |
|
|
|
our_versions = [globals()[j] for j in i.version] |
|
|
|
our_versions = [globals()[j] for j in i.version] |
|
|
|
if version in our_versions: |
|
|
|
if version in our_versions: |
|
|
|
|
|
|
|
if i.node_tree is None: |
|
|
|
|
|
|
|
raise ExportError("'{}': Advanced Logic is missing a node tree for '{}'".format(bo.name, i.version)) |
|
|
|
|
|
|
|
|
|
|
|
# If node_name is defined, then we're only adding a reference. We will make sure that |
|
|
|
# If node_name is defined, then we're only adding a reference. We will make sure that |
|
|
|
# the entire node tree is exported once before the post_export step, however. |
|
|
|
# the entire node tree is exported once before the post_export step, however. |
|
|
|
if i.node_name: |
|
|
|
if i.node_name: |
|
|
|
exporter.want_node_trees[i.node_tree_name] = (bo, so) |
|
|
|
exporter.want_node_trees[i.node_tree.name] = (bo, so) |
|
|
|
node = i.node_tree.nodes.get(i.node_name, None) |
|
|
|
node = i.node_tree.nodes.get(i.node_name, None) |
|
|
|
if node is None: |
|
|
|
if node is None: |
|
|
|
raise ExportError("Node '{}' does not exist in '{}'".format(i.node_name, i.node_tree_name)) |
|
|
|
raise ExportError("Node '{}' does not exist in '{}'".format(i.node_name, i.node_tree.name)) |
|
|
|
# We are going to assume get_key will do the adding correctly. Single modifiers |
|
|
|
# We are going to assume get_key will do the adding correctly. Single modifiers |
|
|
|
# should fetch the appropriate SceneObject before doing anything, so this will |
|
|
|
# should fetch the appropriate SceneObject before doing anything, so this will |
|
|
|
# be a no-op in that case. Multi modifiers should accept any SceneObject, however |
|
|
|
# be a no-op in that case. Multi modifiers should accept any SceneObject, however |
|
|
|
node.get_key(exporter, so) |
|
|
|
node.get_key(exporter, so) |
|
|
|
else: |
|
|
|
else: |
|
|
|
exporter.node_trees_exported.add(i.node_tree_name) |
|
|
|
exporter.node_trees_exported.add(i.node_tree.name) |
|
|
|
i.node_tree.export(exporter, bo, so) |
|
|
|
i.node_tree.export(exporter, bo, so) |
|
|
|
|
|
|
|
|
|
|
|
def harvest_actors(self): |
|
|
|
def harvest_actors(self): |
|
|
|