Skip to content

Commit

Permalink
Fix creating MM Image Plane v1
Browse files Browse the repository at this point in the history
v1 is deprecated, but at least now it can be created, before this
commit, the function was actually broken.

GitHub issue #263.
  • Loading branch information
david-cattermole committed Sep 4, 2024
1 parent 8760cf2 commit 5c57838
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
10 changes: 8 additions & 2 deletions mel/AETemplates/AEmmImagePlaneShapeTemplate.mel
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ global proc AEmmImagePlaneShape_browser(
string $cmd = "";
$cmd = $cmd + "import mmSolver.tools.createimageplane.tool as tool;\n";
$cmd = $cmd + "import mmSolver.tools.createimageplane.lib as lib;\n";
$cmd = $cmd + "import mmSolver.tools.createimageplane._lib.constant as const;\n";
$cmd = $cmd + "version = const.MM_IMAGE_PLANE_VERSION_ONE;\n";
$cmd = $cmd + "image_seq = tool.prompt_user_for_image_sequence();\n";
$cmd = $cmd + "if image_seq:\n";
$cmd = $cmd + " mm_ip_shp = \"" + $image_plane_shp + "\";\n";
Expand All @@ -106,7 +108,8 @@ global proc AEmmImagePlaneShape_browser(
$cmd = $cmd + " lib.set_image_sequence(\n";
$cmd = $cmd + " mm_ip_shp,\n";
$cmd = $cmd + " image_seq,\n";
$cmd = $cmd + " attr_name=attr_name\n";
$cmd = $cmd + " attr_name=attr_name,\n";
$cmd = $cmd + " version=version\n";
$cmd = $cmd + " )\n";
$cmd = $cmd + " else:\n";
$cmd = $cmd + " maya.cmds.setAttr(\n";
Expand Down Expand Up @@ -135,6 +138,8 @@ global proc AEmmImagePlaneShape_sequenceSlotChanged(
$cmd = $cmd + "import os.path;\n";
$cmd = $cmd + "import mmSolver.tools.createimageplane.tool as tool;\n";
$cmd = $cmd + "import mmSolver.tools.createimageplane.lib as lib;\n";
$cmd = $cmd + "import mmSolver.tools.createimageplane._lib.constant as const;\n";
$cmd = $cmd + "version = const.MM_IMAGE_PLANE_VERSION_ONE;\n";
$cmd = $cmd + "mm_ip_shp = \"" + $image_plane_shp + "\";\n";
$cmd = $cmd + "attr_name = \"" + $attr_name + "\";\n";
$cmd = $cmd + "current_slot_attr = \"" + $slot_attr_name + "\";\n";
Expand All @@ -145,7 +150,8 @@ global proc AEmmImagePlaneShape_sequenceSlotChanged(
$cmd = $cmd + "lib.set_image_sequence(\n";
$cmd = $cmd + " mm_ip_shp,\n";
$cmd = $cmd + " image_seq,\n";
$cmd = $cmd + " attr_name=current_slot_attr\n";
$cmd = $cmd + " attr_name=current_slot_attr,\n";
$cmd = $cmd + " version=version\n";
$cmd = $cmd + ")\n";

python($cmd);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ def create_shape_node(
# Add extra message attributes for finding nodes during callbacks.
if shader_node_network is not None:
maya.cmds.addAttr(shp, longName='shaderFileNode', attributeType='message')
lib_utils.force_connect_attr(file_node + '.message', shp + '.shaderFileNode')

# Logic to calculate the frame number.
node = maya.cmds.createNode('mmImageSequenceFrameLogic')
Expand Down
6 changes: 3 additions & 3 deletions python/mmSolver/tools/createimageplane/tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,11 +147,11 @@ def _run(version):
# user has the transform and shape nodes selected.
if cam_shp in created:
continue
mm_ip_tfm, mm_ip_shp = lib.create_image_plane_on_camera(cam)
mm_ip_tfm, mm_ip_shp = lib.create_image_plane_on_camera(cam, version=version)

image_seq = prompt_user_for_image_sequence()
if image_seq:
lib.set_image_sequence(mm_ip_tfm, image_seq)
lib.set_image_sequence(mm_ip_tfm, image_seq, version=version)

nodes.append(mm_ip_shp)
created.add(cam_shp)
Expand All @@ -168,7 +168,7 @@ def _run(version):


def main():
_run(const.MM_IMAGE_PLANE_VERSION_ONE)
_run(const.MM_IMAGE_PLANE_VERSION_TWO)


def main_version_one():
Expand Down

0 comments on commit 5c57838

Please sign in to comment.